KEYCLOAK-5850: Del realm role broken on permissions & Users tabs.

This commit is contained in:
Stan Silvert 2017-11-15 14:12:03 -05:00 committed by Stian Thorgersen
parent f96c3312e2
commit dc05134e41
4 changed files with 28 additions and 14 deletions

View file

@ -2536,10 +2536,15 @@ getManageClientId = function(realm) {
}
}
module.controller('RealmRolePermissionsCtrl', function($scope, $http, $route, $location, realm, role, RoleManagementPermissions, Client, Notifications) {
module.controller('RealmRolePermissionsCtrl', function($scope, $http, $route, $location, realm, role, RoleManagementPermissions, Client, Notifications, Dialog, RealmRoleRemover) {
console.log('RealmRolePermissionsCtrl');
$scope.role = role;
$scope.realm = realm;
$scope.remove = function() {
RealmRoleRemover.remove($scope.role, realm, Dialog, $location, Notifications);
};
RoleManagementPermissions.get({realm: realm.realm, role: role.id}, function(data) {
$scope.permissions = data;
$scope.$watch('permissions.enabled', function(newVal, oldVal) {

View file

@ -1433,7 +1433,7 @@ module.controller('RoleListCtrl', function($scope, $route, Dialog, Notifications
module.controller('RoleDetailCtrl', function($scope, realm, role, roles, clients,
Role, ClientRole, RoleById, RoleRealmComposites, RoleClientComposites,
$http, $location, Dialog, Notifications) {
$http, $location, Dialog, Notifications, RealmRoleRemover) {
$scope.realm = realm;
$scope.role = angular.copy(role);
$scope.create = !role.name;
@ -1461,15 +1461,7 @@ module.controller('RoleDetailCtrl', function($scope, realm, role, roles, clients
};
$scope.remove = function() {
Dialog.confirmDelete($scope.role.name, 'role', function () {
$scope.role.$remove({
realm: realm.realm,
role: $scope.role.id
}, function () {
$location.url("/realms/" + realm.realm + "/roles");
Notifications.success("The role has been deleted.");
});
});
RealmRoleRemover.remove($scope.role, realm, Dialog, $location, Notifications);
};
$scope.cancel = function () {

View file

@ -1,4 +1,4 @@
module.controller('RoleMembersCtrl', function($scope, realm, role, RoleMembership) {
module.controller('RoleMembersCtrl', function($scope, realm, role, RoleMembership, Dialog, Notifications, $location, RealmRoleRemover) {
$scope.realm = realm;
$scope.page = 0;
$scope.role = role;
@ -10,6 +10,9 @@ module.controller('RoleMembersCtrl', function($scope, realm, role, RoleMembershi
first : 0
}
$scope.remove = function() {
RealmRoleRemover.remove($scope.role, realm, Dialog, $location, Notifications);
};
$scope.firstPage = function() {
$scope.query.first = 0;

View file

@ -461,6 +461,20 @@ module.service('LastFlowSelected', function() {
this.alias = null;
});
module.service('RealmRoleRemover', function() {
this.remove = function (role, realm, Dialog, $location, Notifications) {
Dialog.confirmDelete(role.name, 'role', function () {
role.$remove({
realm: realm.realm,
role: role.id
}, function () {
$location.url("/realms/" + realm.realm + "/roles");
Notifications.success("The role has been deleted.");
});
});
};
});
module.factory('UserSessionStats', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/users/:user/session-stats', {
realm : '@realm',