From cce8814254c42a46786d5ec9a695eae714b8d0d9 Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Wed, 5 Feb 2014 10:28:11 -0500 Subject: [PATCH] composite switch --- .../resources/META-INF/resources/admin/js/services.js | 6 ++++++ .../admin/partials/application-role-detail.html | 8 ++++++-- .../resources/admin/partials/application-role-list.html | 8 +++++--- .../META-INF/resources/admin/partials/role-detail.html | 8 ++++++-- .../META-INF/resources/admin/partials/role-list.html | 8 +++++--- .../keycloak/representations/idm/RoleRepresentation.java | 9 +++++++++ .../services/managers/ModelToRepresentation.java | 1 + 7 files changed, 38 insertions(+), 10 deletions(-) diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/services.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/services.js index b572a10519..c20d729b1e 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/js/services.js +++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/services.js @@ -235,6 +235,8 @@ function roleControl($scope, realm, role, roles, applications, if (!role.id) return; + $scope.compositeSwitch = role.composite; + $scope.compositeSwitchDisabled = role.composite; $scope.realmRoles = angular.copy(roles); $scope.selectedRealmRoles = []; $scope.selectedRealmMappings = []; @@ -273,6 +275,7 @@ function roleControl($scope, realm, role, roles, applications, }); $scope.addRealmRole = function() { + $scope.compositeSwitchDisabled=true; $http.post('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites', $scope.selectedRealmRoles).success(function() { for (var i = 0; i < $scope.selectedRealmRoles.length; i++) { @@ -288,6 +291,7 @@ function roleControl($scope, realm, role, roles, applications, }; $scope.deleteRealmRole = function() { + $scope.compositeSwitchDisabled=true; $http.delete('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites', {data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function() { for (var i = 0; i < $scope.selectedRealmMappings.length; i++) { @@ -303,6 +307,7 @@ function roleControl($scope, realm, role, roles, applications, }; $scope.addApplicationRole = function() { + $scope.compositeSwitchDisabled=true; $http.post('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites', $scope.selectedApplicationRoles).success(function() { for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) { @@ -318,6 +323,7 @@ function roleControl($scope, realm, role, roles, applications, }; $scope.deleteApplicationRole = function() { + $scope.compositeSwitchDisabled=true; $http.delete('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites', {data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function() { for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) { diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-detail.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-detail.html index fc399120c9..c7ac2018e3 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-detail.html +++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-detail.html @@ -52,6 +52,10 @@ required> --> +
+ + +
-
+
Composite Realm Roles
@@ -98,7 +102,7 @@
-
+
Composite Application Roles
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-list.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-list.html index 43fa91e67d..1e09376d70 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-list.html +++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-list.html @@ -27,7 +27,7 @@ Table of realm roles - +
Add Role @@ -35,7 +35,7 @@ - +
+
+ + +
-
+
Composite Realm Roles
@@ -94,7 +98,7 @@
-
+
Composite Application Roles
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/role-list.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/role-list.html index 34af283493..53d7de0482 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/role-list.html +++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/role-list.html @@ -27,7 +27,7 @@ - - + - + diff --git a/core/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java index faf9a5dc12..34ea91f841 100755 --- a/core/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java @@ -12,6 +12,7 @@ public class RoleRepresentation { protected String id; protected String name; protected String description; + protected boolean composite; protected Composites composites; public static class Composites { @@ -80,4 +81,12 @@ public class RoleRepresentation { public String toString() { return name; } + + public boolean isComposite() { + return composite; + } + + public void setComposite(boolean composite) { + this.composite = composite; + } } diff --git a/services/src/main/java/org/keycloak/services/managers/ModelToRepresentation.java b/services/src/main/java/org/keycloak/services/managers/ModelToRepresentation.java index efcd1dccae..a706360ade 100755 --- a/services/src/main/java/org/keycloak/services/managers/ModelToRepresentation.java +++ b/services/src/main/java/org/keycloak/services/managers/ModelToRepresentation.java @@ -51,6 +51,7 @@ public class ModelToRepresentation { rep.setId(role.getId()); rep.setName(role.getName()); rep.setDescription(role.getDescription()); + rep.setComposite(role.isComposite()); return rep; }
+
Add Role @@ -35,7 +35,7 @@
+
Role NameComposite Description
+
{{role.name}}{{role.composite}} {{role.description}}