Ver código fonte

user effective permissions

develop
Robin Thoni 9 anos atrás
pai
commit
8d4bb3a221

+ 8
- 3
luticate/controllers/modals/useredit.controller.js Ver arquivo

@@ -48,7 +48,7 @@ angular.module('luticate')
48 48
             {
49 49
                 if ($scope.user.Id != null) {
50 50
                     var defer = $q.defer();
51
-                    if (luticateAuthCache.hasEffectivePermissions("LU_USER_EDIT")) {
51
+                    if (luticateAuthCache.hasEffectivePermission("LU_USER_EDIT")) {
52 52
                         luticateAuthUsers.edit({
53 53
                             user_id: $scope.user.Id,
54 54
                             email: $scope.user.Email,
@@ -80,7 +80,7 @@ angular.module('luticate')
80 80
             $scope.mayEditPassword = function(defer)
81 81
             {
82 82
                 if ($scope.userPassword.value != ""
83
-                    && luticateAuthCache.hasEffectivePermissions("LU_USER_SET_PASSWORD")) {
83
+                    && luticateAuthCache.hasEffectivePermission("LU_USER_SET_PASSWORD")) {
84 84
                     luticateAuthUsers.setPassword({
85 85
                         user_id: $scope.user.Id,
86 86
                         password: $scope.userPassword.value
@@ -90,10 +90,15 @@ angular.module('luticate')
90 90
                 else {
91 91
                     defer.resolve(data);
92 92
                 }
93
-;            }
93
+            };
94 94
 
95 95
             $scope.editPermissions = function(user)
96 96
             {
97 97
                 dialogs.create('views/modals/userpermissions.html', 'UserPermissionsController', user);
98 98
             };
99
+
100
+            $scope.showEffectivePermissions = function(user)
101
+            {
102
+                dialogs.create('views/modals/usereffectivepermissions.html', 'UserEffectivePermissionsController', user);
103
+            };
99 104
         }]);

+ 41
- 0
luticate/controllers/modals/usereffectivepermissions.controller.js Ver arquivo

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

+ 1
- 0
luticate/index.html Ver arquivo

@@ -58,6 +58,7 @@
58 58
     <script src="controllers/modals/groupedit.controller.js"></script>
59 59
     <script src="controllers/modals/permissionedit.controller.js"></script>
60 60
     <script src="controllers/modals/userpermissions.controller.js"></script>
61
+    <script src="controllers/modals/usereffectivepermissions.controller.js"></script>
61 62
     <script src="controllers/modals/grouppermissions.controller.js"></script>
62 63
 
63 64
     <!-- SDK -->

+ 1
- 1
luticate/views/modals/groupedit.html Ver arquivo

@@ -5,7 +5,7 @@
5 5
             <input id="name" class="form-control" ng-model="group.Name" required lu-enable-permission="{{ permission }}"/>
6 6
         </div>
7 7
     </div>
8
-    <div class="form-group" lu-show-permission="LU_PERM_GROUP_GET">
8
+    <div class="form-group" lu-show-permission="LU_PERM_GROUP_GET,LU_PERM_GET">
9 9
         <button type="button" class="btn btn-default col-sm-offset-2"
10 10
                 ng-click="editPermissions(group)" ng-show="group.Id != null">
11 11
             Edit Permissions

+ 8
- 3
luticate/views/modals/useredit.html Ver arquivo

@@ -41,10 +41,15 @@
41 41
             <p class="error" ng-show="form.password2.$error.same_passwords">Passwords do not match</p>
42 42
         </div>
43 43
     </div>
44
-    <div class="form-group" lu-show-permission="LU_PERM_USER_GET">
45
-        <button type="button" class="btn btn-default col-sm-offset-2"
44
+    <div class="form-group">
45
+        <div class="col-sm-2"></div>
46
+        <button type="button" class="btn btn-default" lu-show-permission="LU_PERM_USER_GET,LU_PERM_GET"
46 47
                 ng-click="editPermissions(user)" ng-show="user.Id != null">
47
-            Edit Permissions
48
+            Edit permissions
49
+        </button>
50
+        <button type="button" class="btn btn-default" lu-show-permission="LU_PERM_EFFECTIVE_GET"
51
+                ng-click="showEffectivePermissions(user)" ng-show="user.Id != null">
52
+            Show effective permissions
48 53
         </button>
49 54
     </div>
50 55
 </dialog-ok-cancel>

+ 4
- 0
luticate/views/modals/usereffectivepermissions.html Ver arquivo

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

Carregando…
Cancelar
Salvar