Browse Source

permissions users get/add/edit/del

develop
Robin Thoni 9 years ago
parent
commit
7516782093

+ 7
- 2
luticate/controllers/modals/useredit.controller.js View File

3
  */
3
  */
4
 
4
 
5
 angular.module('luticate')
5
 angular.module('luticate')
6
-    .controller('UserEditController', ['$scope', 'luticateAuthUsers', 'data', '$q',
7
-        function($scope, luticateAuthUsers, data, $q) {
6
+    .controller('UserEditController', ['$scope', 'luticateAuthUsers', 'data', '$q', 'dialogs',
7
+        function($scope, luticateAuthUsers, data, $q, dialogs) {
8
             if (data != null) {
8
             if (data != null) {
9
                 $scope.user = data;
9
                 $scope.user = data;
10
             }
10
             }
76
                     return luticateAuthUsers.add(user, promiseAddUser);
76
                     return luticateAuthUsers.add(user, promiseAddUser);
77
                 }
77
                 }
78
             };
78
             };
79
+
80
+            $scope.editPermissions = function(user)
81
+            {
82
+                dialogs.create('views/modals/userpermissions.html', 'UserPermissionsController', user);
83
+            };
79
         }]);
84
         }]);

+ 46
- 0
luticate/controllers/modals/userpermissions.controller.js View File

1
+/**
2
+ * Created by robin on 11/2/15.
3
+ */
4
+
5
+angular.module('luticate')
6
+    .controller('UserPermissionsController', ['$scope', 'luticateAuthPermissionsUser', 'data',
7
+        function($scope, luticateAuthPermissionsUser, data) {
8
+
9
+            $scope.user = data;
10
+
11
+            $scope.luPermissionEdit = {
12
+                item: $scope.user,
13
+
14
+                getGetAllPromise: function (page, perPage, promise) {
15
+                    return luticateAuthPermissionsUser.getAll({
16
+                        user_id: this.item.Id,
17
+                        page: page,
18
+                        perPage: perPage
19
+                    }, promise);
20
+                },
21
+
22
+                getAddPermissionPromise: function (permission_name, permission_value, promise) {
23
+                    return luticateAuthPermissionsUser.add({
24
+                        user_id: this.item.Id,
25
+                        permission_name: permission_name,
26
+                        permission_value: permission_value
27
+                    }, promise);
28
+                },
29
+
30
+                getEditPermissionPromise: function (permission_name, permission_value, promise) {
31
+                    return luticateAuthPermissionsUser.edit({
32
+                        user_id: this.item.Id,
33
+                        permission_name: permission_name,
34
+                        permission_value: permission_value
35
+                    }, promise);
36
+                },
37
+
38
+                getDelPermissionPromise: function (permission_name, promise) {
39
+                    return luticateAuthPermissionsUser.del({
40
+                        user_id: this.item.Id,
41
+                        permission_name: permission_name
42
+                    }, promise);
43
+                }
44
+            };
45
+
46
+        }]);

+ 4
- 0
luticate/index.html View File

28
     <script src="../bower_components/luticate-utils/src/request.js"></script>
28
     <script src="../bower_components/luticate-utils/src/request.js"></script>
29
     <script src="../bower_components/luticate-utils/src/lubusy.js"></script>
29
     <script src="../bower_components/luticate-utils/src/lubusy.js"></script>
30
     <script src="../bower_components/luticate-utils/src/lutable.js"></script>
30
     <script src="../bower_components/luticate-utils/src/lutable.js"></script>
31
+    <script src="../bower_components/luticate-utils/src/lupermissionsedit.js"></script>
31
     <script src="../bower_components/luticate-utils/src/modals/dialogerror.js"></script>
32
     <script src="../bower_components/luticate-utils/src/modals/dialogerror.js"></script>
32
     <script src="../bower_components/luticate-utils/src/modals/dialogerrorhelper.js"></script>
33
     <script src="../bower_components/luticate-utils/src/modals/dialogerrorhelper.js"></script>
33
     <script src="../bower_components/luticate-utils/src/modals/dialogokcancel.js"></script>
34
     <script src="../bower_components/luticate-utils/src/modals/dialogokcancel.js"></script>
35
+    <script src="../bower_components/luticate-utils/src/modals/dialogclose.js"></script>
34
     <script src="../bower_components/luticate-auth/src/luticateauth.js"></script>
36
     <script src="../bower_components/luticate-auth/src/luticateauth.js"></script>
35
     <script src="../bower_components/luticate-auth/src/users.js"></script>
37
     <script src="../bower_components/luticate-auth/src/users.js"></script>
36
     <script src="../bower_components/luticate-auth/src/groups.js"></script>
38
     <script src="../bower_components/luticate-auth/src/groups.js"></script>
37
     <script src="../bower_components/luticate-auth/src/permissions.js"></script>
39
     <script src="../bower_components/luticate-auth/src/permissions.js"></script>
40
+    <script src="../bower_components/luticate-auth/src/permissionsuser.js"></script>
38
     <script src="../bower_components/luticate-auth/src/cache.js"></script>
41
     <script src="../bower_components/luticate-auth/src/cache.js"></script>
39
 
42
 
40
     <!-- scripts -->
43
     <!-- scripts -->
52
     <script src="controllers/modals/useredit.controller.js"></script>
55
     <script src="controllers/modals/useredit.controller.js"></script>
53
     <script src="controllers/modals/groupedit.controller.js"></script>
56
     <script src="controllers/modals/groupedit.controller.js"></script>
54
     <script src="controllers/modals/permissionedit.controller.js"></script>
57
     <script src="controllers/modals/permissionedit.controller.js"></script>
58
+    <script src="controllers/modals/userpermissions.controller.js"></script>
55
 
59
 
56
     <!-- SDK -->
60
     <!-- SDK -->
57
     <script src="../sdk/cache.js"></script>
61
     <script src="../sdk/cache.js"></script>

+ 3
- 0
luticate/views/modals/useredit.html View File

41
             <p class="error" ng-show="form.password2.$error.same_passwords">Passwords do not match</p>
41
             <p class="error" ng-show="form.password2.$error.same_passwords">Passwords do not match</p>
42
         </div>
42
         </div>
43
     </div>
43
     </div>
44
+    <div class="form-group">
45
+        <button type="button" class="btn btn-default col-sm-offset-2" ng-click="editPermissions(user)">Edit Permissions</button>
46
+    </div>
44
 </dialog-ok-cancel>
47
 </dialog-ok-cancel>

+ 4
- 0
luticate/views/modals/userpermissions.html View File

1
+<!-- Page Content -->
2
+<dialog-close title="Edit {{ user.Username }} permissions">
3
+    <lu-permission-edit lu-model="luPermissionEdit"></lu-permission-edit>
4
+</dialog-close>

Loading…
Cancel
Save