1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
module.factory('ResourceServer', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server', {
realm : '@realm',
client: '@client'
}, {
'update' : {method : 'PUT'},
'import' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/import', method : 'POST'},
'settings' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/settings', method : 'GET'}
});
});
module.factory('ResourceServerResource', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/resource/:rsrid', {
realm : '@realm',
client: '@client',
rsrid : '@rsrid'
}, {
'update' : {method : 'PUT'},
'search' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/resource/search', method : 'GET'},
'scopes' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/resource/:rsrid/scopes', method : 'GET', isArray: true},
'permissions' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/resource/:rsrid/permissions', method : 'GET', isArray: true}
});
});
module.factory('ResourceServerScope', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/scope/:id', {
realm : '@realm',
client: '@client',
id : '@id'
}, {
'update' : {method : 'PUT'},
'search' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/scope/search', method : 'GET'},
'resources' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/scope/:id/resources', method : 'GET', isArray: true},
'permissions' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/scope/:id/permissions', method : 'GET', isArray: true},
});
});
module.factory('ResourceServerPolicy', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy/:type/:id', {
realm : '@realm',
client: '@client',
id : '@id',
type: '@type'
}, {
'update' : {method : 'PUT'},
'search' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy/search', method : 'GET'},
'associatedPolicies' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy/:id/associatedPolicies', method : 'GET', isArray: true},
'dependentPolicies' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy/:id/dependentPolicies', method : 'GET', isArray: true},
'scopes' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy/:id/scopes', method : 'GET', isArray: true},
'resources' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy/:id/resources', method : 'GET', isArray: true}
});
});
module.factory('ResourceServerPermission', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/permission/:type/:id', {
realm : '@realm',
client: '@client',
type: '@type',
id : '@id'
}, {
'update' : {method : 'PUT'},
'search' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/permission/search', method : 'GET'},
'searchPolicies' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy', method : 'GET', isArray: true},
'associatedPolicies' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy/:id/associatedPolicies', method : 'GET', isArray: true},
'dependentPolicies' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy/:id/dependentPolicies', method : 'GET', isArray: true},
'scopes' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/permission/:id/scopes', method : 'GET', isArray: true},
'resources' : {url: authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/permission/:id/resources', method : 'GET', isArray: true}
});
});
module.factory('PolicyProvider', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/clients/:client/authz/resource-server/policy/providers', {
realm : '@realm',
client: '@client'
});
});
module.service('AuthzDialog', function($modal) {
var dialog = {};
var openDialog = function(title, message, btns, template) {
var controller = function($scope, $modalInstance, $sce, title, message, btns) {
$scope.title = title;
$scope.message = $sce.trustAsHtml(message);
$scope.btns = btns;
$scope.ok = function () {
$modalInstance.close();
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};
return $modal.open({
templateUrl: resourceUrl + template,
controller: controller,
resolve: {
title: function() {
return title;
},
message: function() {
return message;
},
btns: function() {
return btns;
}
}
}).result;
}
dialog.confirmDeleteWithMsg = function(name, type, msg, success) {
var title = 'Delete ' + type;
msg += 'Are you sure you want to permanently delete the ' + type + ' <strong>' + name + '</strong> ?';
var btns = {
ok: {
label: 'Delete',
cssClass: 'btn btn-danger'
},
cancel: {
label: 'Cancel',
cssClass: 'btn btn-default'
}
}
openDialog(title, msg, btns, '/templates/authz/kc-authz-modal.html').then(success);
};
dialog.confirmDelete = function(name, type, success) {
var title = 'Delete ' + type;
var msg = 'Are you sure you want to permanently delete the ' + type + ' <strong>' + name + '</strong> ?';
var btns = {
ok: {
label: 'Delete',
cssClass: 'btn btn-danger'
},
cancel: {
label: 'Cancel',
cssClass: 'btn btn-default'
}
}
openDialog(title, msg, btns, '/templates/authz/kc-authz-modal.html').then(success);
}
return dialog;
});
module.factory('RoleManagementPermissions', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/roles-by-id/:role/management/permissions', {
realm : '@realm',
role : '@role'
}, {
update: {
method: 'PUT'
}
});
});
module.factory('UsersManagementPermissions', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/users-management-permissions', {
realm : '@realm'
}, {
update: {
method: 'PUT'
}
});
});
module.factory('ClientManagementPermissions', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/clients/:client/management/permissions', {
realm : '@realm',
client : '@client'
}, {
update: {
method: 'PUT'
}
});
});
module.factory('IdentityProviderManagementPermissions', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/identity-provider/instances/:alias/management/permissions', {
realm : '@realm',
alias : '@alias'
}, {
update: {
method: 'PUT'
}
});
});
module.factory('GroupManagementPermissions', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/groups/:group/management/permissions', {
realm : '@realm',
group : '@group'
}, {
update: {
method: 'PUT'
}
});
});
module.factory('policyViewState', [function () {
return {
model: {
state: {}
}
};
}]);
module.factory('viewState', [function () {
return {
model: {
state: {}
}
};
}]);
|