From f800290d89261665246d31ca06d14536300b014c Mon Sep 17 00:00:00 2001 From: Pedro Igor Date: Mon, 21 May 2018 10:54:13 -0300 Subject: [PATCH] [KEYCLOAK-7082] - Making lists more aligned with patternfly listview component --- .../permission/PermissionsTable.java | 8 +- .../authorization/policy/PoliciesTable.java | 8 +- .../authorization/resource/Resources.java | 8 +- .../resource/ResourcesTable.java | 10 +- .../clients/authorization/scope/Scopes.java | 9 +- .../authorization/scope/ScopesTable.java | 4 +- .../resources/js/authz/authz-controller.js | 137 ++++++---- .../resources/js/authz/authz-services.js | 10 +- .../resource-server-permission-list.html | 69 +++-- .../policy/resource-server-policy-list.html | 71 +++-- .../authz/resource-server-resource-list.html | 251 ++++++++++-------- .../authz/resource-server-scope-list.html | 93 +++---- 12 files changed, 353 insertions(+), 325 deletions(-) diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/PermissionsTable.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/PermissionsTable.java index 71b0139e7c..30789705bb 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/PermissionsTable.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/PermissionsTable.java @@ -65,11 +65,11 @@ public class PermissionsTable extends DataTable { public PolicyRepresentation toRepresentation(WebElement row) { PolicyRepresentation representation = null; List tds = row.findElements(tagName("td")); - if (!(tds.isEmpty() || tds.get(0).getText().isEmpty())) { + if (!(tds.isEmpty() || tds.get(1).getText().isEmpty())) { representation = new PolicyRepresentation(); - representation.setName(tds.get(0).getText()); - representation.setDescription(tds.get(1).getText()); - representation.setType(tds.get(2).getText()); + representation.setName(tds.get(1).getText()); + representation.setDescription(tds.get(2).getText()); + representation.setType(tds.get(3).getText()); } return representation; } diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/PoliciesTable.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/PoliciesTable.java index 50b91da5ee..6d8eed540d 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/PoliciesTable.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/PoliciesTable.java @@ -65,11 +65,11 @@ public class PoliciesTable extends DataTable { public PolicyRepresentation toRepresentation(WebElement row) { PolicyRepresentation representation = null; List tds = row.findElements(tagName("td")); - if (!(tds.isEmpty() || tds.get(0).getText().isEmpty())) { + if (!(tds.isEmpty() || tds.get(1).getText().isEmpty())) { representation = new PolicyRepresentation(); - representation.setName(tds.get(0).getText()); - representation.setDescription(tds.get(1).getText()); - representation.setType(tds.get(2).getText()); + representation.setName(tds.get(1).getText()); + representation.setDescription(tds.get(2).getText()); + representation.setType(tds.get(3).getText()); } return representation; } diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/Resources.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/Resources.java index 72de12c9fa..30b333f6a1 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/Resources.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/Resources.java @@ -21,6 +21,7 @@ import org.keycloak.representations.idm.authorization.ResourceRepresentation; import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.page.Form; import org.keycloak.testsuite.util.WaitUtils; +import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -81,7 +82,12 @@ public class Resources extends Form { for (WebElement row : resources().rows()) { ResourceRepresentation actual = resources().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("td")).get(6).click(); + WebElement td = row.findElements(tagName("td")).get(5); + td.findElement(By.className("dropdown-toggle")).click(); + WebElement actions = td.findElement(By.className("dropdown-menu")); + + actions.findElement(By.linkText("Delete")).click(); + modalDialog.confirmDeletion(); return; } diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/ResourcesTable.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/ResourcesTable.java index 94ed572432..108b66161a 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/ResourcesTable.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/ResourcesTable.java @@ -67,13 +67,13 @@ public class ResourcesTable extends DataTable { ResourceRepresentation representation = null; List tds = row.findElements(tagName("td")); try { - if (!(tds.isEmpty() || tds.get(0).getText().isEmpty())) { + if (!(tds.isEmpty() || tds.get(1).getText().isEmpty())) { representation = new ResourceRepresentation(); - representation.setName(tds.get(0).getText()); - representation.setType(tds.get(1).getText()); - representation.setUri(tds.get(2).getText()); + representation.setName(tds.get(1).getText()); + representation.setType(tds.get(2).getText()); + representation.setUri(tds.get(3).getText()); ResourceOwnerRepresentation owner = new ResourceOwnerRepresentation(); - owner.setName(tds.get(3).getText()); + owner.setName(tds.get(4).getText()); representation.setOwner(owner); } } catch (IndexOutOfBoundsException cause) { diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/Scopes.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/Scopes.java index 06b3201df5..93eaa434c6 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/Scopes.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/Scopes.java @@ -20,11 +20,11 @@ import static org.keycloak.testsuite.util.UIUtils.clickLink; import static org.openqa.selenium.By.tagName; import org.jboss.arquillian.graphene.page.Page; -import org.keycloak.representations.idm.authorization.ResourceRepresentation; import org.keycloak.representations.idm.authorization.ScopeRepresentation; import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.page.Form; import org.keycloak.testsuite.util.WaitUtils; +import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -78,7 +78,12 @@ public class Scopes extends Form { for (WebElement row : scopes().rows()) { ScopeRepresentation actual = scopes().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("td")).get(3).click(); + WebElement td = row.findElements(tagName("td")).get(2); + td.findElement(By.className("dropdown-toggle")).click(); + WebElement actions = td.findElement(By.className("dropdown-menu")); + + actions.findElement(By.linkText("Delete")).click(); + modalDialog.confirmDeletion(); } } diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/ScopesTable.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/ScopesTable.java index 3372cd336d..349890d37d 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/ScopesTable.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/ScopesTable.java @@ -65,9 +65,9 @@ public class ScopesTable extends DataTable { public ScopeRepresentation toRepresentation(WebElement row) { ScopeRepresentation representation = null; List tds = row.findElements(tagName("td")); - if (!(tds.isEmpty() || tds.get(0).getText().isEmpty())) { + if (!(tds.isEmpty() || tds.get(1).getText().isEmpty())) { representation = new ScopeRepresentation(); - representation.setName(tds.get(0).getText()); + representation.setName(tds.get(1).getText()); } return representation; } 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 8636410f65..0968de3bae 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 @@ -144,7 +144,7 @@ var Policies = { } } -module.controller('ResourceServerResourceCtrl', function($scope, $http, $route, $location, realm, ResourceServer, ResourceServerResource, client, AuthzDialog, Notifications) { +module.controller('ResourceServerResourceCtrl', function($scope, $http, $route, $location, realm, ResourceServer, ResourceServerResource, client, AuthzDialog, Notifications, viewState) { $scope.realm = realm; $scope.client = client; @@ -165,6 +165,8 @@ module.controller('ResourceServerResourceCtrl', function($scope, $http, $route, $scope.server = data; $scope.createPolicy = function(resource) { + viewState.state = {}; + viewState.state.previousUrl = '/realms/' + $route.current.params.realm + '/clients/' + client.id + '/authz/resource-server/resource'; $location.path('/realms/' + $route.current.params.realm + '/clients/' + client.id + '/authz/resource-server/permission/resource/create').search({rsrid: resource._id}); } @@ -438,7 +440,7 @@ var Scopes = { } } -module.controller('ResourceServerScopeCtrl', function($scope, $http, $route, $location, realm, ResourceServer, ResourceServerScope,client, AuthzDialog, Notifications) { +module.controller('ResourceServerScopeCtrl', function($scope, $http, $route, $location, realm, ResourceServer, ResourceServerScope,client, AuthzDialog, Notifications, viewState) { $scope.realm = realm; $scope.client = client; @@ -459,6 +461,8 @@ module.controller('ResourceServerScopeCtrl', function($scope, $http, $route, $lo $scope.server = data; $scope.createPolicy = function(scope) { + viewState.state = {}; + viewState.state.previousUrl = '/realms/' + $route.current.params.realm + '/clients/' + client.id + '/authz/resource-server/scope'; $location.path('/realms/' + $route.current.params.realm + '/clients/' + client.id + '/authz/resource-server/permission/scope/create').search({scpid: scope.id}); } @@ -894,7 +898,7 @@ module.controller('ResourceServerPolicyDroolsDetailCtrl', function($scope, $http }, realm, client, $scope); }); -module.controller('ResourceServerPolicyResourceDetailCtrl', function($scope, $route, $location, realm, client, PolicyController, ResourceServerPermission, ResourceServerResource, policyState) { +module.controller('ResourceServerPolicyResourceDetailCtrl', function($scope, $route, $location, realm, client, PolicyController, ResourceServerPermission, ResourceServerResource, policyViewState) { PolicyController.onInit({ getPolicyType : function() { return "resource"; @@ -1032,7 +1036,7 @@ module.controller('ResourceServerPolicyResourceDetailCtrl', function($scope, $ro }, onInitCreate : function(newPolicy) { - policyState.state.previousPage.name = 'authz-add-resource-permission'; + policyViewState.state.previousPage.name = 'authz-add-resource-permission'; $scope.selectedResource = null; var copy = angular.copy($scope.selectedResource); $scope.$watch('selectedResource', function() { @@ -1084,19 +1088,19 @@ module.controller('ResourceServerPolicyResourceDetailCtrl', function($scope, $ro }, onSaveState : function(policy) { - policyState.state.selectedResource = $scope.selectedResource; - policyState.state.applyToResourceTypeFlag = $scope.applyToResourceTypeFlag; + policyViewState.state.selectedResource = $scope.selectedResource; + policyViewState.state.applyToResourceTypeFlag = $scope.applyToResourceTypeFlag; }, onRestoreState : function(policy) { - $scope.selectedResource = policyState.state.selectedResource; - $scope.applyToResourceTypeFlag = policyState.state.applyToResourceTypeFlag; - policy.resourceType = policyState.state.policy.resourceType; + $scope.selectedResource = policyViewState.state.selectedResource; + $scope.applyToResourceTypeFlag = policyViewState.state.applyToResourceTypeFlag; + policy.resourceType = policyViewState.state.policy.resourceType; } }, realm, client, $scope); }); -module.controller('ResourceServerPolicyScopeDetailCtrl', function($scope, $route, $location, realm, client, PolicyController, ResourceServerPolicy, ResourceServerResource, ResourceServerScope, policyState) { +module.controller('ResourceServerPolicyScopeDetailCtrl', function($scope, $route, $location, realm, client, PolicyController, ResourceServerPolicy, ResourceServerResource, ResourceServerScope, policyViewState) { PolicyController.onInit({ getPolicyType : function() { return "scope"; @@ -1343,7 +1347,7 @@ module.controller('ResourceServerPolicyScopeDetailCtrl', function($scope, $route }, onInitCreate : function(newPolicy) { - policyState.state.previousPage.name = 'authz-add-scope-permission'; + policyViewState.state.previousPage.name = 'authz-add-scope-permission'; var scopeId = $location.search()['scpid']; if (scopeId) { @@ -1391,15 +1395,15 @@ module.controller('ResourceServerPolicyScopeDetailCtrl', function($scope, $route }, onSaveState : function(policy) { - policyState.state.selectedScopes = $scope.selectedScopes; - policyState.state.selectedResource = $scope.selectedResource; - policyState.state.resourceScopes = $scope.resourceScopes; + policyViewState.state.selectedScopes = $scope.selectedScopes; + policyViewState.state.selectedResource = $scope.selectedResource; + policyViewState.state.resourceScopes = $scope.resourceScopes; }, onRestoreState : function(policy) { - $scope.selectedScopes = policyState.state.selectedScopes; - $scope.selectedResource = policyState.state.selectedResource; - $scope.resourceScopes = policyState.state.resourceScopes; + $scope.selectedScopes = policyViewState.state.selectedScopes; + $scope.selectedResource = policyViewState.state.selectedResource; + $scope.resourceScopes = policyViewState.state.resourceScopes; } }, realm, client, $scope); }); @@ -2006,7 +2010,7 @@ module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route, } }); -module.controller('ResourceServerPolicyAggregateDetailCtrl', function($scope, $route, $location, realm, PolicyController, ResourceServerPolicy, client, PolicyProvider, policyState) { +module.controller('ResourceServerPolicyAggregateDetailCtrl', function($scope, $route, $location, realm, PolicyController, ResourceServerPolicy, client, PolicyProvider, policyViewState) { PolicyController.onInit({ getPolicyType : function() { return "aggregate"; @@ -2075,7 +2079,7 @@ module.controller('ResourceServerPolicyAggregateDetailCtrl', function($scope, $r }, onInitCreate : function(newPolicy) { - policyState.state.previousPage.name = 'authz-add-aggregated-policy'; + policyViewState.state.previousPage.name = 'authz-add-aggregated-policy'; }, onCreate : function() { @@ -2091,7 +2095,7 @@ module.controller('ResourceServerPolicyAggregateDetailCtrl', function($scope, $r }, realm, client, $scope); }); -module.service("PolicyController", function($http, $route, $location, ResourceServer, ResourceServerPolicy, ResourceServerPermission, AuthzDialog, Notifications, policyState, PolicyProvider) { +module.service("PolicyController", function($http, $route, $location, ResourceServer, ResourceServerPolicy, ResourceServerPermission, AuthzDialog, Notifications, policyViewState, PolicyProvider, viewState) { var PolicyController = {}; @@ -2117,49 +2121,49 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe } }); - if ((!policyState.state || !PolicyController.isBackNewAssociatedPolicy()) && !PolicyController.isNewAssociatedPolicy()) { - policyState.state = {}; + if ((!policyViewState.state || !PolicyController.isBackNewAssociatedPolicy()) && !PolicyController.isNewAssociatedPolicy()) { + policyViewState.state = {}; } - if (!policyState.state.previousPage) { - policyState.state.previousPage = {}; + if (!policyViewState.state.previousPage) { + policyViewState.state.previousPage = {}; } - $scope.policyState = policyState; + $scope.policyViewState = policyViewState; $scope.addPolicy = function(policyType) { - policyState.state.policy = $scope.policy; + policyViewState.state.policy = $scope.policy; if (delegate.onSaveState) { delegate.onSaveState($scope.policy); } if ($scope.selectedPolicies) { - policyState.state.selectedPolicies = $scope.selectedPolicies; + policyViewState.state.selectedPolicies = $scope.selectedPolicies; } var previousUrl = window.location.href.substring(window.location.href.indexOf('/realms')); if (previousUrl.indexOf('back=true') == -1) { - previousUrl = previousUrl + '?back=true'; + previousUrl = previousUrl + (previousUrl.indexOf('?') == -1 ? '?' : '&') + 'back=true'; } - policyState.state.previousUrl = previousUrl; + policyViewState.state.previousUrl = previousUrl; $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/policy/" + policyType.type + "/create?new_policy=true"); } $scope.detailPolicy = function(policy) { - policyState.state.policy = $scope.policy; + policyViewState.state.policy = $scope.policy; if (delegate.onSaveState) { delegate.onSaveState($scope.policy); } if ($scope.selectedPolicies) { - policyState.state.selectedPolicies = $scope.selectedPolicies; + policyViewState.state.selectedPolicies = $scope.selectedPolicies; } var previousUrl = window.location.href.substring(window.location.href.indexOf('/realms')); if (previousUrl.indexOf('back=true') == -1) { - previousUrl = previousUrl + '?back=true'; + previousUrl = previousUrl + (previousUrl.indexOf('?') == -1 ? '?' : '&') + 'back=true'; } - policyState.state.previousUrl = previousUrl; + policyViewState.state.previousUrl = previousUrl; $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/policy/" + policy.type + "/" + policy.id + "?new_policy=true"); } @@ -2243,6 +2247,12 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe $scope.changed = $scope.historyBackOnSaveOrCancel || PolicyController.isBackNewAssociatedPolicy(); + if (viewState.state != null && viewState.state.previousUrl != null) { + $scope.previousUrl = viewState.state.previousUrl; + policyViewState.state.rootUrl = $scope.previousUrl; + viewState.state = {}; + } + $scope.policy = angular.copy(policy); $scope.$watch('policy', function() { @@ -2267,17 +2277,21 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe } service.save({realm : realm.realm, client : client.id, type: $scope.policy.type}, $scope.policy, function(data) { if (delegate.isPermission()) { - if ($scope.historyBackOnSaveOrCancel) { - policyState.state.newPolicyName = $scope.policy.name; - $location.url(policyState.state.previousUrl); + if ($scope.historyBackOnSaveOrCancel || policyViewState.state.rootUrl != null) { + if (policyViewState.state.rootUrl != null) { + $location.url(policyViewState.state.rootUrl); + } else { + policyViewState.state.newPolicyName = $scope.policy.name; + $location.url(policyViewState.state.previousUrl); + } } else { $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/permission/" + $scope.policy.type + "/" + data.id); } Notifications.success("The permission has been created."); } else { if ($scope.historyBackOnSaveOrCancel) { - policyState.state.newPolicyName = $scope.policy.name; - $location.url(policyState.state.previousUrl); + policyViewState.state.newPolicyName = $scope.policy.name; + $location.url(policyViewState.state.previousUrl); } else { $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/policy/" + $scope.policy.type + "/" + data.id); } @@ -2289,14 +2303,18 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe $scope.reset = function() { if (delegate.isPermission()) { - if ($scope.historyBackOnSaveOrCancel) { - $location.url(policyState.state.previousUrl); + if ($scope.historyBackOnSaveOrCancel || policyViewState.state.rootUrl != null) { + if (policyViewState.state.rootUrl != null) { + $location.url(policyViewState.state.rootUrl); + } else { + $location.url(policyViewState.state.previousUrl); + } } else { $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/permission/"); } } else { if ($scope.historyBackOnSaveOrCancel) { - $location.url(policyState.state.previousUrl); + $location.url(policyViewState.state.previousUrl); } else { $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/policy/"); } @@ -2339,7 +2357,7 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe service.update({realm : realm.realm, client : client.id, type: $scope.policy.type, id : $scope.policy.id}, $scope.policy, function() { if (delegate.isPermission()) { if ($scope.historyBackOnSaveOrCancel) { - $location.url(policyState.state.previousUrl); + $location.url(policyViewState.state.previousUrl); } else { $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/permission/" + $scope.policy.type + "/" + $scope.policy.id); } @@ -2347,7 +2365,7 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe Notifications.success("The permission has been updated."); } else { if ($scope.historyBackOnSaveOrCancel) { - $location.url(policyState.state.previousUrl); + $location.url(policyViewState.state.previousUrl); } else { $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/policy/" + $scope.policy.type + "/" + $scope.policy.id); } @@ -2360,7 +2378,7 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe $scope.reset = function() { if ($scope.historyBackOnSaveOrCancel) { - $location.url(policyState.state.previousUrl); + $location.url(policyViewState.state.previousUrl); } else { var freshPolicy = angular.copy(data); @@ -2402,40 +2420,45 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe } this.restoreState = function($scope) { - $scope.policy.name = policyState.state.policy.name; - $scope.policy.description = policyState.state.policy.description; - $scope.policy.decisionStrategy = policyState.state.policy.decisionStrategy; - $scope.policy.logic = policyState.state.policy.logic; - $scope.selectedPolicies = policyState.state.selectedPolicies; + $scope.policy.name = policyViewState.state.policy.name; + $scope.policy.description = policyViewState.state.policy.description; + $scope.policy.decisionStrategy = policyViewState.state.policy.decisionStrategy; + $scope.policy.logic = policyViewState.state.policy.logic; + $scope.selectedPolicies = policyViewState.state.selectedPolicies; if (!$scope.selectedPolicies) { $scope.selectedPolicies = []; } $scope.changed = true; - var previousPage = policyState.state.previousPage; + var previousPage = policyViewState.state.previousPage; - if (policyState.state.newPolicyName) { + if (policyViewState.state.newPolicyName) { ResourceServerPolicy.query({ realm: realm.realm, client : client.id, permission: false, - name: policyState.state.newPolicyName, + name: policyViewState.state.newPolicyName, max : 20, first : 0 }, function(response) { for (i = 0; i < response.length; i++) { - if (response[i].name == policyState.state.newPolicyName) { + if (response[i].name == policyViewState.state.newPolicyName) { response[i].text = response[i].name; $scope.selectedPolicies.push(response[i]); } } - policyState.state = {}; - policyState.state.previousPage = previousPage; + + var rootUrl = policyViewState.state.rootUrl; + policyViewState.state = {}; + policyViewState.state.previousPage = previousPage; + policyViewState.state.rootUrl = rootUrl; }); } else { - policyState.state = {}; - policyState.state.previousPage = previousPage; + var rootUrl = policyViewState.state.rootUrl; + policyViewState.state = {}; + policyViewState.state.previousPage = previousPage; + policyViewState.state.rootUrl = rootUrl; } } } diff --git a/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-services.js b/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-services.js index 12ca4305a5..5e20472233 100644 --- a/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-services.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-services.js @@ -200,7 +200,15 @@ module.factory('GroupManagementPermissions', function($resource) { }); }); -module.factory('policyState', [function () { +module.factory('policyViewState', [function () { + return { + model: { + state: {} + } + }; +}]); + +module.factory('viewState', [function () { return { model: { state: {} diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/authz/permission/resource-server-permission-list.html b/themes/src/main/resources/theme/base/admin/resources/partials/authz/permission/resource-server-permission-list.html index 2ee735b17f..98ca2ae793 100644 --- a/themes/src/main/resources/theme/base/admin/resources/partials/authz/permission/resource-server-permission-list.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/authz/permission/resource-server-permission-list.html @@ -41,12 +41,6 @@ -
- -
-
- -
- {{:: 'authz-hide-details' | translate}} - {{:: 'authz-show-details' | translate}} -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- + + +
+ {{:: 'filter' | translate}}:   +
+
+ +
+
-
- {{:: 'create' | translate}} +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
- - - - {{:: 'name' | translate}} - {{:: 'type' | translate}} - {{:: 'authz-uri' | translate}} - {{:: 'authz-owner' | translate}} - {{:: 'actions' | translate}} - + +
+ + + + + {{:: 'name' | translate}} + {{:: 'type' | translate}} + {{:: 'authz-uri' | translate}} + {{:: 'authz-owner' | translate}} + {{:: 'actions' | translate}} + - +
- - - + + +
- - {{resource.name}} - - {{resource.type}} - {{:: 'authz-no-type-defined' | translate}} - - - {{resource.uri}} - {{:: 'authz-no-uri-defined' | translate}} - - {{resource.owner.name}} - - {{:: 'authz-show-details' | translate}} - - - {{:: 'authz-hide-details' | translate}} - - - {{:: 'authz-create-permission' | translate}} - - - {{:: 'delete' | translate}} - - - - -
- - - - - - - - - - - - - -
ScopesAssociated Permissions
- {{:: 'authz-no-scopes-assigned' | translate}} - - - {{:: 'authz-no-permission-assigned' | translate}} - -
+ + + + + + + {{resource.name}} + + + {{resource.type}} + {{:: 'authz-no-type-defined' | translate}} + + + {{resource.uri}} + {{:: 'authz-no-uri-defined' | translate}} + + {{resource.owner.name}} + + + + + + +
+
+
- - - - {{:: 'no-results' | translate}} - {{:: 'authz-no-resources-available' | translate}} - +
+
+
+
{{:: 'authz-scopes' | translate}}
+
+ {{:: 'authz-no-scopes-assigned' | translate}} + {{scope.name}}{{$last ? '' : ', '}} +
+
{{:: 'authz-associated-permissions' | translate}}
+
+ {{:: 'authz-no-permission-assigned' | translate}} + {{policy.name}}{{$last ? '' : ', '}} +
+
+
+
+
+ + + + {{:: 'no-results' | translate}} + {{:: 'authz-no-resources-available' | + translate}} + +
diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/authz/resource-server-scope-list.html b/themes/src/main/resources/theme/base/admin/resources/partials/authz/resource-server-scope-list.html index 519c9f58d6..34ce2b0264 100644 --- a/themes/src/main/resources/theme/base/admin/resources/partials/authz/resource-server-scope-list.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/authz/resource-server-scope-list.html @@ -12,7 +12,7 @@ - + - + - - - - + - - - + -
+
@@ -21,12 +21,6 @@
-
- -
{{:: 'create' | translate}} @@ -35,13 +29,14 @@
{{:: 'name' | translate}}{{:: 'actions' | translate}}{{:: 'actions' | translate}}
+
@@ -51,52 +46,48 @@
{{scope.name}} - {{:: 'authz-show-details' | translate}} +
+ + - {{:: 'authz-hide-details' | translate}} - - {{:: 'authz-create-permission' | translate}} - - {{:: 'delete' | translate}} + {{scope.name}} +
-
- - - - - - - - - - - - - -
ResourcesAssociated Permissions
- {{:: 'authz-no-resources-assigned' | translate}} - - - {{:: 'authz-no-permission-assigned' | translate}} - -
+
+
+
+ +
+
+
+
+
{{:: 'authz-resources' | translate}}
+
+ {{:: 'authz-no-resources-assigned' | translate}} + {{resource.name}}{{$last ? '' : ', '}} +
+
{{:: 'authz-associated-permissions' | translate}}
+
+ {{:: 'authz-no-permission-assigned' | translate}} + {{policy.name}}{{$last ? '' : ', '}} +
+
+
+