Selaa lähdekoodia

permissions groups get/add/edit/del

develop
Robin Thoni 9 vuotta sitten
vanhempi
commit
8c611111aa

+ 8
- 3
luticate/controllers/modals/groupedit.controller.js Näytä tiedosto

@@ -3,8 +3,8 @@
3 3
  */
4 4
 
5 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 8
             if (data != null) {
9 9
                 $scope.group = data;
10 10
             }
@@ -27,5 +27,10 @@ angular.module('luticate')
27 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 Näytä tiedosto

@@ -0,0 +1,46 @@
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 Näytä tiedosto

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

+ 6
- 0
luticate/views/modals/groupedit.html Näytä tiedosto

@@ -5,4 +5,10 @@
5 5
             <input id="name" class="form-control" ng-model="group.Name" required/>
6 6
         </div>
7 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 14
 </dialog-ok-cancel>

+ 4
- 0
luticate/views/modals/grouppermissions.html Näytä tiedosto

@@ -0,0 +1,4 @@
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 Näytä tiedosto

@@ -42,6 +42,9 @@
42 42
         </div>
43 43
     </div>
44 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 49
     </div>
47 50
 </dialog-ok-cancel>

Loading…
Peruuta
Tallenna