Browse Source

user effective permissions

develop
Robin Thoni 9 years ago
parent
commit
8d4bb3a221

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

48
             {
48
             {
49
                 if ($scope.user.Id != null) {
49
                 if ($scope.user.Id != null) {
50
                     var defer = $q.defer();
50
                     var defer = $q.defer();
51
-                    if (luticateAuthCache.hasEffectivePermissions("LU_USER_EDIT")) {
51
+                    if (luticateAuthCache.hasEffectivePermission("LU_USER_EDIT")) {
52
                         luticateAuthUsers.edit({
52
                         luticateAuthUsers.edit({
53
                             user_id: $scope.user.Id,
53
                             user_id: $scope.user.Id,
54
                             email: $scope.user.Email,
54
                             email: $scope.user.Email,
80
             $scope.mayEditPassword = function(defer)
80
             $scope.mayEditPassword = function(defer)
81
             {
81
             {
82
                 if ($scope.userPassword.value != ""
82
                 if ($scope.userPassword.value != ""
83
-                    && luticateAuthCache.hasEffectivePermissions("LU_USER_SET_PASSWORD")) {
83
+                    && luticateAuthCache.hasEffectivePermission("LU_USER_SET_PASSWORD")) {
84
                     luticateAuthUsers.setPassword({
84
                     luticateAuthUsers.setPassword({
85
                         user_id: $scope.user.Id,
85
                         user_id: $scope.user.Id,
86
                         password: $scope.userPassword.value
86
                         password: $scope.userPassword.value
90
                 else {
90
                 else {
91
                     defer.resolve(data);
91
                     defer.resolve(data);
92
                 }
92
                 }
93
-;            }
93
+            };
94
 
94
 
95
             $scope.editPermissions = function(user)
95
             $scope.editPermissions = function(user)
96
             {
96
             {
97
                 dialogs.create('views/modals/userpermissions.html', 'UserPermissionsController', user);
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 View File

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 View File

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

+ 1
- 1
luticate/views/modals/groupedit.html View File

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

+ 8
- 3
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" 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
                 ng-click="editPermissions(user)" ng-show="user.Id != null">
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
         </button>
53
         </button>
49
     </div>
54
     </div>
50
 </dialog-ok-cancel>
55
 </dialog-ok-cancel>

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

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>

Loading…
Cancel
Save