|
@@ -15,6 +15,7 @@ angular.module('luticateUtils')
|
15
|
15
|
|
16
|
16
|
$scope.permissions = [];
|
17
|
17
|
$scope.allPermissions = [];
|
|
18
|
+ $scope.allPermissionsCleared = [];
|
18
|
19
|
$scope.tmpPermission = {
|
19
|
20
|
Name: "",
|
20
|
21
|
Value: true
|
|
@@ -69,6 +70,22 @@ angular.module('luticateUtils')
|
69
|
70
|
luModel.getGetAllPromise(null, null, promiseLoadPermissions)
|
70
|
71
|
.then(function (permissions) {
|
71
|
72
|
$scope.permissions = permissions.Data;
|
|
73
|
+ $scope.allPermissionsCleared = [];
|
|
74
|
+ for (var i = 0; i < $scope.allPermissions.length; ++i) {
|
|
75
|
+ var p = $scope.allPermissions[i];
|
|
76
|
+ if ($scope.permissions.find(function(p2)
|
|
77
|
+ {
|
|
78
|
+ return p.Name == p2.Name;
|
|
79
|
+ }) == null) {
|
|
80
|
+ $scope.allPermissionsCleared.push(p);
|
|
81
|
+ }
|
|
82
|
+ }
|
|
83
|
+ if ($scope.allPermissionsCleared.length > 0) {
|
|
84
|
+ $scope.tmpPermission.Name = $scope.allPermissionsCleared[0].Name;
|
|
85
|
+ }
|
|
86
|
+ else {
|
|
87
|
+ $scope.tmpPermission.Name = "";
|
|
88
|
+ }
|
72
|
89
|
}, luticateDialogErrorHelper.errorDialog);
|
73
|
90
|
};
|
74
|
91
|
|
|
@@ -81,11 +98,10 @@ angular.module('luticateUtils')
|
81
|
98
|
luticateAuthPermissions.getAll(null, promiseLoadAllPermissions)
|
82
|
99
|
.then(function (permissions) {
|
83
|
100
|
$scope.allPermissions = permissions.Data;
|
84
|
|
- $scope.tmpPermission.Name = $scope.allPermissions[0].Name;
|
|
101
|
+ $scope.loadPermissions();
|
85
|
102
|
}, luticateDialogErrorHelper.errorDialog);
|
86
|
103
|
};
|
87
|
104
|
|
88
|
|
- $scope.loadPermissions();
|
89
|
105
|
$scope.loadAllPermissions();
|
90
|
106
|
}
|
91
|
107
|
};
|
|
@@ -122,7 +138,7 @@ angular.module('luticateUtils').run(['$templateCache', function($templateCache)
|
122
|
138
|
' {{ tmpPermission.Name }} <span class="caret"></span>' +
|
123
|
139
|
' </a>' +
|
124
|
140
|
' <ul class="dropdown-menu">' +
|
125
|
|
-' <li ng-repeat="permission in allPermissions">' +
|
|
141
|
+' <li ng-repeat="permission in allPermissionsCleared">' +
|
126
|
142
|
' <a href="" ng-click="tmpPermission.Name = permission.Name">{{ permission.Name}}</a>' +
|
127
|
143
|
'</li>' +
|
128
|
144
|
'</ul>' +
|
|
@@ -136,7 +152,7 @@ angular.module('luticateUtils').run(['$templateCache', function($templateCache)
|
136
|
152
|
'<li><a href="" ng-click="tmpPermission.Value = true">Allow</a></li>' +
|
137
|
153
|
'</ul>' +
|
138
|
154
|
'</div>' +
|
139
|
|
-'<button type="button" class="btn btn-default" ng-click="addPermission(tmpPermission)">' +
|
|
155
|
+'<button type="button" class="btn btn-default" ng-click="addPermission(tmpPermission)" ng-disabled="allPermissionsCleared.length == 0">' +
|
140
|
156
|
' <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add' +
|
141
|
157
|
' </button>' +
|
142
|
158
|
' </div>' +
|