From 11d1dd641966b14d720b92e27a3d28a0264d5467 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Fri, 17 Jul 2015 11:46:02 +0200 Subject: [PATCH] KEYCLOAK-1470 --- .../admin/resources/js/controllers/clients.js | 16 ++++++++++++---- .../base/admin/resources/js/controllers/realm.js | 8 ++++++++ .../base/admin/resources/js/controllers/users.js | 4 +++- .../resources/partials/client-role-detail.html | 8 ++++---- .../partials/client-scope-mappings.html | 8 ++++---- .../resources/partials/realm-default-roles.html | 8 ++++---- .../admin/resources/partials/role-detail.html | 8 ++++---- .../admin/resources/partials/role-mappings.html | 8 ++++---- 8 files changed, 43 insertions(+), 25 deletions(-) diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js index d5c7226fe0..2699138dc5 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js @@ -906,32 +906,40 @@ module.controller('ClientScopeMappingCtrl', function($scope, $http, realm, clien }; $scope.addRealmRole = function() { + var roles = $scope.selectedRealmRoles; + $scope.selectedRealmRoles = []; $http.post(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/realm', - $scope.selectedRealmRoles).success(function() { + roles).success(function() { updateRealmRoles(); Notifications.success("Scope mappings updated."); }); }; $scope.deleteRealmRole = function() { + var roles = $scope.selectedRealmMappings; + $scope.selectedRealmMappings = []; $http.delete(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/realm', - {data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function () { + {data : roles, headers : {"content-type" : "application/json"}}).success(function () { updateRealmRoles(); Notifications.success("Scope mappings updated."); }); }; $scope.addClientRole = function() { + var roles = $scope.selectedClientRoles; + $scope.selectedClientRoles = []; $http.post(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/clients/' + $scope.targetClient.id, - $scope.selectedClientRoles).success(function () { + roles).success(function () { updateClientRoles(); Notifications.success("Scope mappings updated."); }); }; $scope.deleteClientRole = function() { + var roles = $scope.selectedClientMappings; + $scope.selectedClientMappings = []; $http.delete(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/clients/' + $scope.targetClient.id, - {data : $scope.selectedClientMappings, headers : {"content-type" : "application/json"}}).success(function () { + {data : roles, headers : {"content-type" : "application/json"}}).success(function () { updateClientRoles(); Notifications.success("Scope mappings updated."); }); diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js index 335bef3415..789b6f036f 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js @@ -480,6 +480,8 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clien } } + $scope.selectedRealmRoles = []; + // Update/save the realm with new default roles. Realm.update($scope.realm, function () { Notifications.success("Realm default roles updated."); @@ -498,6 +500,8 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clien } } + $scope.selectedRealmDefRoles = []; + // Update/save the realm with new default roles. //var realmCopy = angular.copy($scope.realm); Realm.update($scope.realm, function () { @@ -550,6 +554,8 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clien } } + $scope.selectedClientRoles = []; + // Update/save the selected client with new default roles. Client.update({ realm: $scope.realm.realm, @@ -574,6 +580,8 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clien } } + $scope.selectedClientDefRoles = []; + // Update/save the selected client with new default roles. Client.update({ realm: $scope.realm.realm, diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js index 2bb3b29f06..11443b4e1c 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js @@ -19,8 +19,10 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, cl $scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id}); $scope.addRealmRole = function() { + var roles = $scope.selectedRealmRoles; + $scope.selectedRealmRoles = []; $http.post(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.id + '/role-mappings/realm', - $scope.selectedRealmRoles).success(function() { + roles).success(function() { $scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.id}); $scope.realmRoles = AvailableRealmRoleMapping.query({realm : realm.realm, userId : user.id}); $scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id}); diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-detail.html index 80adbc41c8..a64e03750e 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-detail.html @@ -70,7 +70,7 @@ ng-model="selectedRealmRoles" ng-options="r.name for r in realmRoles"> - @@ -82,7 +82,7 @@ ng-model="selectedRealmMappings" ng-options="r.name for r in realmMappings"> - @@ -109,7 +109,7 @@ ng-model="selectedClientRoles" ng-options="r.name for r in clientRoles"> - @@ -121,7 +121,7 @@ ng-model="selectedClientMappings" ng-options="r.name for r in clientMappings"> - diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-scope-mappings.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-scope-mappings.html index a0449def20..e53c30686a 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-scope-mappings.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-scope-mappings.html @@ -37,7 +37,7 @@ ng-model="selectedRealmRoles" ng-options="r.name for r in realmRoles"> - @@ -49,7 +49,7 @@ ng-model="selectedRealmMappings" ng-options="r.name for r in realmMappings"> - @@ -85,7 +85,7 @@ ng-model="selectedClientRoles" ng-options="r.name for r in clientRoles"> - @@ -97,7 +97,7 @@ ng-model="selectedClientMappings" ng-options="r.name for r in clientMappings"> - diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-default-roles.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-default-roles.html index 33fec9e9c5..7d9ad1c7fd 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-default-roles.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-default-roles.html @@ -19,7 +19,7 @@ ng-model="selectedRealmRoles" ng-options="r for r in availableRealmRoles | orderBy:'toString()'"> - @@ -31,7 +31,7 @@ ng-model="selectedRealmDefRoles" ng-options="r for r in realm.defaultRoles | orderBy:'toString()'"> - @@ -57,7 +57,7 @@ ng-model="selectedClientRoles" ng-options="r for r in availableClientRoles | orderBy:'toString()'"> - @@ -69,7 +69,7 @@ ng-model="selectedClientDefRoles" ng-options="r for r in client.defaultRoles | orderBy:'toString()'"> - diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-detail.html index af2fb87b70..9bf9b696ee 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-detail.html @@ -66,7 +66,7 @@ ng-model="selectedRealmRoles" ng-options="r.name for r in realmRoles | orderBy:'name'"> - @@ -78,7 +78,7 @@ ng-model="selectedRealmMappings" ng-options="r.name for r in realmMappings | orderBy:'name'"> - @@ -105,7 +105,7 @@ ng-model="selectedClientRoles" ng-options="r.name for r in clientRoles | orderBy:'name'"> - @@ -117,7 +117,7 @@ ng-model="selectedClientMappings" ng-options="r.name for r in clientMappings | orderBy:'name'"> - diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html index 2d48db3489..e82edf500d 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html @@ -21,7 +21,7 @@ ng-model="selectedRealmRoles" ng-options="r.name for r in realmRoles"> - Realm roles that can be assigned to the user. @@ -34,7 +34,7 @@ ng-model="selectedRealmMappings" ng-options="r.name for r in realmMappings"> - @@ -69,7 +69,7 @@ ng-model="selectedClientRoles" ng-options="r.name for r in clientRoles"> - @@ -81,7 +81,7 @@ ng-model="selectedClientMappings" ng-options="r.name for r in clientMappings"> -