Browse Source

permissions groups get/add/edit/del

develop
Robin Thoni 9 years ago
parent
commit
8c611111aa

+ 8
- 3
luticate/controllers/modals/groupedit.controller.js View File

3
  */
3
  */
4
 
4
 
5
 angular.module('luticate')
5
 angular.module('luticate')
6
-    .controller('GroupEditController', ['$scope', 'luticateAuthGroups', 'data',
7
-        function($scope, luticateAuthGroups, data) {
6
+    .controller('GroupEditController', ['$scope', 'luticateAuthGroups', 'data', 'dialogs',
7
+        function($scope, luticateAuthGroups, data, dialogs) {
8
             if (data != null) {
8
             if (data != null) {
9
                 $scope.group = data;
9
                 $scope.group = data;
10
             }
10
             }
27
                         group_name: $scope.group.Name
27
                         group_name: $scope.group.Name
28
                     });
28
                     });
29
                 }
29
                 }
30
-            }
30
+            };
31
+
32
+            $scope.editPermissions = function(group)
33
+            {
34
+                dialogs.create('views/modals/grouppermissions.html', 'GroupPermissionsController', group);
35
+            };
31
         }]);
36
         }]);

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

1
+/**
2
+ * Created by robin on 11/2/15.
3
+ */
4
+
5
+angular.module('luticate')
6
+    .controller('GroupPermissionsController', ['$scope', 'luticateAuthPermissionsGroup', 'data',
7
+        function($scope, luticateAuthPermissionsGroup, data) {
8
+
9
+            $scope.group = data;
10
+
11
+            $scope.luPermissionEdit = {
12
+                item: $scope.group,
13
+
14
+                getGetAllPromise: function (page, perPage, promise) {
15
+                    return luticateAuthPermissionsGroup.getAll({
16
+                        group_id: this.item.Id,
17
+                        page: page,
18
+                        perPage: perPage
19
+                    }, promise);
20
+                },
21
+
22
+                getAddPermissionPromise: function (permission_name, permission_value, promise) {
23
+                    return luticateAuthPermissionsGroup.add({
24
+                        group_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 luticateAuthPermissionsGroup.edit({
32
+                        group_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 luticateAuthPermissionsGroup.del({
40
+                        group_id: this.item.Id,
41
+                        permission_name: permission_name
42
+                    }, promise);
43
+                }
44
+            };
45
+
46
+        }]);

+ 2
- 0
luticate/index.html View File

38
     <script src="../bower_components/luticate-auth/src/groups.js"></script>
38
     <script src="../bower_components/luticate-auth/src/groups.js"></script>
39
     <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>
40
     <script src="../bower_components/luticate-auth/src/permissionsuser.js"></script>
41
+    <script src="../bower_components/luticate-auth/src/permissionsgroup.js"></script>
41
     <script src="../bower_components/luticate-auth/src/cache.js"></script>
42
     <script src="../bower_components/luticate-auth/src/cache.js"></script>
42
 
43
 
43
     <!-- scripts -->
44
     <!-- scripts -->
56
     <script src="controllers/modals/groupedit.controller.js"></script>
57
     <script src="controllers/modals/groupedit.controller.js"></script>
57
     <script src="controllers/modals/permissionedit.controller.js"></script>
58
     <script src="controllers/modals/permissionedit.controller.js"></script>
58
     <script src="controllers/modals/userpermissions.controller.js"></script>
59
     <script src="controllers/modals/userpermissions.controller.js"></script>
60
+    <script src="controllers/modals/grouppermissions.controller.js"></script>
59
 
61
 
60
     <!-- SDK -->
62
     <!-- SDK -->
61
     <script src="../sdk/cache.js"></script>
63
     <script src="../sdk/cache.js"></script>

+ 6
- 0
luticate/views/modals/groupedit.html View File

5
             <input id="name" class="form-control" ng-model="group.Name" required/>
5
             <input id="name" class="form-control" ng-model="group.Name" required/>
6
         </div>
6
         </div>
7
     </div>
7
     </div>
8
+    <div class="form-group">
9
+        <button type="button" class="btn btn-default col-sm-offset-2"
10
+                ng-click="editPermissions(group)" ng-show="group.Id != null">
11
+            Edit Permissions
12
+        </button>
13
+    </div>
8
 </dialog-ok-cancel>
14
 </dialog-ok-cancel>

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

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

+ 4
- 1
luticate/views/modals/useredit.html View File

42
         </div>
42
         </div>
43
     </div>
43
     </div>
44
     <div class="form-group">
44
     <div class="form-group">
45
-        <button type="button" class="btn btn-default col-sm-offset-2" ng-click="editPermissions(user)">Edit Permissions</button>
45
+        <button type="button" class="btn btn-default col-sm-offset-2"
46
+                ng-click="editPermissions(user)" ng-show="user.Id != null">
47
+            Edit Permissions
48
+        </button>
46
     </div>
49
     </div>
47
 </dialog-ok-cancel>
50
 </dialog-ok-cancel>

Loading…
Cancel
Save