From 876edc01866d9a9a31965faf5f9c186b83b1a461 Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Mon, 17 Jul 2017 17:55:59 -0400 Subject: [PATCH 1/2] ... --- .../org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java index 6a737c89d9..d73f39a938 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java @@ -377,14 +377,14 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest { return true; } - //@Test + @Test public void testDemo() throws Exception { testingClient.server().run(FineGrainAdminUnitTest::setupDemo); Thread.sleep(1000000000); } - @Test + //@Test public void testEvaluationLocal() throws Exception { testingClient.server().run(FineGrainAdminUnitTest::setupPolices); testingClient.server().run(FineGrainAdminUnitTest::setupUsers); From 11ff5a05e9561c3beb3a53627468843ab4c338cd Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Tue, 18 Jul 2017 11:03:01 -0400 Subject: [PATCH 2/2] KEYCLOAK-5205 --- .../admin/FineGrainAdminUnitTest.java | 2 +- .../resources/js/authz/authz-controller.js | 69 +++++++++++-------- .../authz/mgmt/client-permissions.html | 2 +- .../authz/mgmt/client-role-permissions.html | 2 +- .../authz/mgmt/group-permissions.html | 2 +- .../authz/mgmt/realm-role-permissions.html | 2 +- .../authz/mgmt/users-permissions.html | 2 +- 7 files changed, 45 insertions(+), 36 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java index d73f39a938..02121bbf48 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java @@ -377,7 +377,7 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest { return true; } - @Test + //@Test public void testDemo() throws Exception { testingClient.server().run(FineGrainAdminUnitTest::setupDemo); Thread.sleep(1000000000); diff --git a/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-controller.js b/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-controller.js index 36ecfaf300..14c9392af4 100644 --- a/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-controller.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-controller.js @@ -2538,16 +2538,17 @@ module.controller('RealmRolePermissionsCtrl', function($scope, $http, $route, $l $scope.realm = realm; RoleManagementPermissions.get({realm: realm.realm, role: role.id}, function(data) { $scope.permissions = data; + $scope.$watch('permissions.enabled', function(newVal, oldVal) { + if (newVal != oldVal) { + console.log('Changing permissions enabled to: ' + $scope.permissions.enabled); + var param = {enabled: $scope.permissions.enabled}; + $scope.permissions= RoleManagementPermissions.update({realm: realm.realm, role:role.id}, param); + } + }, true); }); Client.query({realm: realm.realm, clientId: getManageClientId(realm)}, function(data) { $scope.realmManagementClientId = data[0].id; }); - $scope.setEnabled = function() { - var param = { enabled: $scope.permissions.enabled}; - $scope.permissions= RoleManagementPermissions.update({realm: realm.realm, role:role.id}, param); - }; - - }); module.controller('ClientRolePermissionsCtrl', function($scope, $http, $route, $location, realm, client, role, Client, RoleManagementPermissions, Client, Notifications) { console.log('RealmRolePermissionsCtrl'); @@ -2556,33 +2557,39 @@ module.controller('ClientRolePermissionsCtrl', function($scope, $http, $route, $ $scope.realm = realm; RoleManagementPermissions.get({realm: realm.realm, role: role.id}, function(data) { $scope.permissions = data; + $scope.$watch('permissions.enabled', function(newVal, oldVal) { + if (newVal != oldVal) { + console.log('Changing permissions enabled to: ' + $scope.permissions.enabled); + var param = {enabled: $scope.permissions.enabled}; + $scope.permissions = RoleManagementPermissions.update({realm: realm.realm, role:role.id}, param); + } + }, true); }); Client.query({realm: realm.realm, clientId: getManageClientId(realm)}, function(data) { $scope.realmManagementClientId = data[0].id; }); - $scope.setEnabled = function() { - console.log('perssions enabled: ' + $scope.permissions.enabled); - var param = { enabled: $scope.permissions.enabled}; - $scope.permissions = RoleManagementPermissions.update({realm: realm.realm, role:role.id}, param); - }; - - }); module.controller('UsersPermissionsCtrl', function($scope, $http, $route, $location, realm, UsersManagementPermissions, Client, Notifications) { console.log('UsersPermissionsCtrl'); $scope.realm = realm; + var first = true; UsersManagementPermissions.get({realm: realm.realm}, function(data) { $scope.permissions = data; + $scope.$watch('permissions.enabled', function(newVal, oldVal) { + if (newVal != oldVal) { + console.log('Changing permissions enabled to: ' + $scope.permissions.enabled); + var param = {enabled: $scope.permissions.enabled}; + $scope.permissions = UsersManagementPermissions.update({realm: realm.realm}, param); + + } + }, true); }); Client.query({realm: realm.realm, clientId: getManageClientId(realm)}, function(data) { $scope.realmManagementClientId = data[0].id; }); - $scope.changeIt = function() { - console.log('before permissions.enabled=' + $scope.permissions.enabled); - var param = { enabled: $scope.permissions.enabled}; - $scope.permissions = UsersManagementPermissions.update({realm: realm.realm}, param); - }; + + }); @@ -2592,16 +2599,17 @@ module.controller('ClientPermissionsCtrl', function($scope, $http, $route, $loca $scope.realm = realm; ClientManagementPermissions.get({realm: realm.realm, client: client.id}, function(data) { $scope.permissions = data; + $scope.$watch('permissions.enabled', function(newVal, oldVal) { + if (newVal != oldVal) { + console.log('Changing permissions enabled to: ' + $scope.permissions.enabled); + var param = {enabled: $scope.permissions.enabled}; + $scope.permissions = ClientManagementPermissions.update({realm: realm.realm, client: client.id}, param); + } + }, true); }); Client.query({realm: realm.realm, clientId: getManageClientId(realm)}, function(data) { $scope.realmManagementClientId = data[0].id; }); - $scope.setEnabled = function() { - var param = { enabled: $scope.permissions.enabled}; - $scope.permissions = ClientManagementPermissions.update({realm: realm.realm, client: client.id}, param); - }; - - }); module.controller('GroupPermissionsCtrl', function($scope, $http, $route, $location, realm, group, GroupManagementPermissions, Client, Notifications) { @@ -2612,13 +2620,14 @@ module.controller('GroupPermissionsCtrl', function($scope, $http, $route, $locat }); GroupManagementPermissions.get({realm: realm.realm, group: group.id}, function(data) { $scope.permissions = data; + $scope.$watch('permissions.enabled', function(newVal, oldVal) { + if (newVal != oldVal) { + console.log('Changing permissions enabled to: ' + $scope.permissions.enabled); + var param = {enabled: $scope.permissions.enabled}; + $scope.permissions = GroupManagementPermissions.update({realm: realm.realm, group: group.id}, param); + } + }, true); }); - $scope.setEnabled = function() { - var param = { enabled: $scope.permissions.enabled}; - $scope.permissions = GroupManagementPermissions.update({realm: realm.realm, group: group.id}, param); - }; - - }); diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/client-permissions.html b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/client-permissions.html index abc21a4d90..7f29fd71c7 100644 --- a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/client-permissions.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/client-permissions.html @@ -11,7 +11,7 @@
- +
{{:: 'permissions-enabled-role.tooltip' | translate}}
diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/client-role-permissions.html b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/client-role-permissions.html index c5f37ea320..c76ecec055 100644 --- a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/client-role-permissions.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/client-role-permissions.html @@ -12,7 +12,7 @@
- +
{{:: 'permissions-enabled-role.tooltip' | translate}}
diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/group-permissions.html b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/group-permissions.html index 897a0ed36d..f2be6d99a9 100644 --- a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/group-permissions.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/group-permissions.html @@ -11,7 +11,7 @@
- +
{{:: 'permissions-enabled-role.tooltip' | translate}}
diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/realm-role-permissions.html b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/realm-role-permissions.html index 9c03333397..e21ee63ed7 100644 --- a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/realm-role-permissions.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/realm-role-permissions.html @@ -11,7 +11,7 @@
- +
{{:: 'permissions-enabled-role.tooltip' | translate}}
diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/users-permissions.html b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/users-permissions.html index 4a5661f28b..2665bba99a 100644 --- a/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/users-permissions.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/authz/mgmt/users-permissions.html @@ -7,7 +7,7 @@
- +
{{:: 'permissions-enabled-users.tooltip' | translate}}