Merge pull request #5213 from pedroigor/KEYCLOAK-7082

[KEYCLOAK-7082] - Making lists more aligned with patternfly listview component
This commit is contained in:
Pedro Igor 2018-05-22 10:52:16 -03:00 committed by GitHub
commit 06f108df3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 353 additions and 325 deletions

View file

@ -65,11 +65,11 @@ public class PermissionsTable extends DataTable {
public PolicyRepresentation toRepresentation(WebElement row) { public PolicyRepresentation toRepresentation(WebElement row) {
PolicyRepresentation representation = null; PolicyRepresentation representation = null;
List<WebElement> tds = row.findElements(tagName("td")); List<WebElement> 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 = new PolicyRepresentation();
representation.setName(tds.get(0).getText()); representation.setName(tds.get(1).getText());
representation.setDescription(tds.get(1).getText()); representation.setDescription(tds.get(2).getText());
representation.setType(tds.get(2).getText()); representation.setType(tds.get(3).getText());
} }
return representation; return representation;
} }

View file

@ -65,11 +65,11 @@ public class PoliciesTable extends DataTable {
public PolicyRepresentation toRepresentation(WebElement row) { public PolicyRepresentation toRepresentation(WebElement row) {
PolicyRepresentation representation = null; PolicyRepresentation representation = null;
List<WebElement> tds = row.findElements(tagName("td")); List<WebElement> 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 = new PolicyRepresentation();
representation.setName(tds.get(0).getText()); representation.setName(tds.get(1).getText());
representation.setDescription(tds.get(1).getText()); representation.setDescription(tds.get(2).getText());
representation.setType(tds.get(2).getText()); representation.setType(tds.get(3).getText());
} }
return representation; return representation;
} }

View file

@ -21,6 +21,7 @@ import org.keycloak.representations.idm.authorization.ResourceRepresentation;
import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.console.page.fragment.ModalDialog;
import org.keycloak.testsuite.page.Form; import org.keycloak.testsuite.page.Form;
import org.keycloak.testsuite.util.WaitUtils; import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBy;
@ -81,7 +82,12 @@ public class Resources extends Form {
for (WebElement row : resources().rows()) { for (WebElement row : resources().rows()) {
ResourceRepresentation actual = resources().toRepresentation(row); ResourceRepresentation actual = resources().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) { 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(); modalDialog.confirmDeletion();
return; return;
} }

View file

@ -67,13 +67,13 @@ public class ResourcesTable extends DataTable {
ResourceRepresentation representation = null; ResourceRepresentation representation = null;
List<WebElement> tds = row.findElements(tagName("td")); List<WebElement> tds = row.findElements(tagName("td"));
try { try {
if (!(tds.isEmpty() || tds.get(0).getText().isEmpty())) { if (!(tds.isEmpty() || tds.get(1).getText().isEmpty())) {
representation = new ResourceRepresentation(); representation = new ResourceRepresentation();
representation.setName(tds.get(0).getText()); representation.setName(tds.get(1).getText());
representation.setType(tds.get(1).getText()); representation.setType(tds.get(2).getText());
representation.setUri(tds.get(2).getText()); representation.setUri(tds.get(3).getText());
ResourceOwnerRepresentation owner = new ResourceOwnerRepresentation(); ResourceOwnerRepresentation owner = new ResourceOwnerRepresentation();
owner.setName(tds.get(3).getText()); owner.setName(tds.get(4).getText());
representation.setOwner(owner); representation.setOwner(owner);
} }
} catch (IndexOutOfBoundsException cause) { } catch (IndexOutOfBoundsException cause) {

View file

@ -20,11 +20,11 @@ import static org.keycloak.testsuite.util.UIUtils.clickLink;
import static org.openqa.selenium.By.tagName; import static org.openqa.selenium.By.tagName;
import org.jboss.arquillian.graphene.page.Page; import org.jboss.arquillian.graphene.page.Page;
import org.keycloak.representations.idm.authorization.ResourceRepresentation;
import org.keycloak.representations.idm.authorization.ScopeRepresentation; import org.keycloak.representations.idm.authorization.ScopeRepresentation;
import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.console.page.fragment.ModalDialog;
import org.keycloak.testsuite.page.Form; import org.keycloak.testsuite.page.Form;
import org.keycloak.testsuite.util.WaitUtils; import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBy;
@ -78,7 +78,12 @@ public class Scopes extends Form {
for (WebElement row : scopes().rows()) { for (WebElement row : scopes().rows()) {
ScopeRepresentation actual = scopes().toRepresentation(row); ScopeRepresentation actual = scopes().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) { 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(); modalDialog.confirmDeletion();
} }
} }

View file

@ -65,9 +65,9 @@ public class ScopesTable extends DataTable {
public ScopeRepresentation toRepresentation(WebElement row) { public ScopeRepresentation toRepresentation(WebElement row) {
ScopeRepresentation representation = null; ScopeRepresentation representation = null;
List<WebElement> tds = row.findElements(tagName("td")); List<WebElement> 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 = new ScopeRepresentation();
representation.setName(tds.get(0).getText()); representation.setName(tds.get(1).getText());
} }
return representation; return representation;
} }

View file

@ -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.realm = realm;
$scope.client = client; $scope.client = client;
@ -165,6 +165,8 @@ module.controller('ResourceServerResourceCtrl', function($scope, $http, $route,
$scope.server = data; $scope.server = data;
$scope.createPolicy = function(resource) { $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}); $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.realm = realm;
$scope.client = client; $scope.client = client;
@ -459,6 +461,8 @@ module.controller('ResourceServerScopeCtrl', function($scope, $http, $route, $lo
$scope.server = data; $scope.server = data;
$scope.createPolicy = function(scope) { $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}); $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); }, 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({ PolicyController.onInit({
getPolicyType : function() { getPolicyType : function() {
return "resource"; return "resource";
@ -1032,7 +1036,7 @@ module.controller('ResourceServerPolicyResourceDetailCtrl', function($scope, $ro
}, },
onInitCreate : function(newPolicy) { onInitCreate : function(newPolicy) {
policyState.state.previousPage.name = 'authz-add-resource-permission'; policyViewState.state.previousPage.name = 'authz-add-resource-permission';
$scope.selectedResource = null; $scope.selectedResource = null;
var copy = angular.copy($scope.selectedResource); var copy = angular.copy($scope.selectedResource);
$scope.$watch('selectedResource', function() { $scope.$watch('selectedResource', function() {
@ -1084,19 +1088,19 @@ module.controller('ResourceServerPolicyResourceDetailCtrl', function($scope, $ro
}, },
onSaveState : function(policy) { onSaveState : function(policy) {
policyState.state.selectedResource = $scope.selectedResource; policyViewState.state.selectedResource = $scope.selectedResource;
policyState.state.applyToResourceTypeFlag = $scope.applyToResourceTypeFlag; policyViewState.state.applyToResourceTypeFlag = $scope.applyToResourceTypeFlag;
}, },
onRestoreState : function(policy) { onRestoreState : function(policy) {
$scope.selectedResource = policyState.state.selectedResource; $scope.selectedResource = policyViewState.state.selectedResource;
$scope.applyToResourceTypeFlag = policyState.state.applyToResourceTypeFlag; $scope.applyToResourceTypeFlag = policyViewState.state.applyToResourceTypeFlag;
policy.resourceType = policyState.state.policy.resourceType; policy.resourceType = policyViewState.state.policy.resourceType;
} }
}, realm, client, $scope); }, 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({ PolicyController.onInit({
getPolicyType : function() { getPolicyType : function() {
return "scope"; return "scope";
@ -1343,7 +1347,7 @@ module.controller('ResourceServerPolicyScopeDetailCtrl', function($scope, $route
}, },
onInitCreate : function(newPolicy) { onInitCreate : function(newPolicy) {
policyState.state.previousPage.name = 'authz-add-scope-permission'; policyViewState.state.previousPage.name = 'authz-add-scope-permission';
var scopeId = $location.search()['scpid']; var scopeId = $location.search()['scpid'];
if (scopeId) { if (scopeId) {
@ -1391,15 +1395,15 @@ module.controller('ResourceServerPolicyScopeDetailCtrl', function($scope, $route
}, },
onSaveState : function(policy) { onSaveState : function(policy) {
policyState.state.selectedScopes = $scope.selectedScopes; policyViewState.state.selectedScopes = $scope.selectedScopes;
policyState.state.selectedResource = $scope.selectedResource; policyViewState.state.selectedResource = $scope.selectedResource;
policyState.state.resourceScopes = $scope.resourceScopes; policyViewState.state.resourceScopes = $scope.resourceScopes;
}, },
onRestoreState : function(policy) { onRestoreState : function(policy) {
$scope.selectedScopes = policyState.state.selectedScopes; $scope.selectedScopes = policyViewState.state.selectedScopes;
$scope.selectedResource = policyState.state.selectedResource; $scope.selectedResource = policyViewState.state.selectedResource;
$scope.resourceScopes = policyState.state.resourceScopes; $scope.resourceScopes = policyViewState.state.resourceScopes;
} }
}, realm, client, $scope); }, 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({ PolicyController.onInit({
getPolicyType : function() { getPolicyType : function() {
return "aggregate"; return "aggregate";
@ -2075,7 +2079,7 @@ module.controller('ResourceServerPolicyAggregateDetailCtrl', function($scope, $r
}, },
onInitCreate : function(newPolicy) { onInitCreate : function(newPolicy) {
policyState.state.previousPage.name = 'authz-add-aggregated-policy'; policyViewState.state.previousPage.name = 'authz-add-aggregated-policy';
}, },
onCreate : function() { onCreate : function() {
@ -2091,7 +2095,7 @@ module.controller('ResourceServerPolicyAggregateDetailCtrl', function($scope, $r
}, realm, client, $scope); }, 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 = {}; var PolicyController = {};
@ -2117,49 +2121,49 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe
} }
}); });
if ((!policyState.state || !PolicyController.isBackNewAssociatedPolicy()) && !PolicyController.isNewAssociatedPolicy()) { if ((!policyViewState.state || !PolicyController.isBackNewAssociatedPolicy()) && !PolicyController.isNewAssociatedPolicy()) {
policyState.state = {}; policyViewState.state = {};
} }
if (!policyState.state.previousPage) { if (!policyViewState.state.previousPage) {
policyState.state.previousPage = {}; policyViewState.state.previousPage = {};
} }
$scope.policyState = policyState; $scope.policyViewState = policyViewState;
$scope.addPolicy = function(policyType) { $scope.addPolicy = function(policyType) {
policyState.state.policy = $scope.policy; policyViewState.state.policy = $scope.policy;
if (delegate.onSaveState) { if (delegate.onSaveState) {
delegate.onSaveState($scope.policy); delegate.onSaveState($scope.policy);
} }
if ($scope.selectedPolicies) { if ($scope.selectedPolicies) {
policyState.state.selectedPolicies = $scope.selectedPolicies; policyViewState.state.selectedPolicies = $scope.selectedPolicies;
} }
var previousUrl = window.location.href.substring(window.location.href.indexOf('/realms')); var previousUrl = window.location.href.substring(window.location.href.indexOf('/realms'));
if (previousUrl.indexOf('back=true') == -1) { 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"); $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/policy/" + policyType.type + "/create?new_policy=true");
} }
$scope.detailPolicy = function(policy) { $scope.detailPolicy = function(policy) {
policyState.state.policy = $scope.policy; policyViewState.state.policy = $scope.policy;
if (delegate.onSaveState) { if (delegate.onSaveState) {
delegate.onSaveState($scope.policy); delegate.onSaveState($scope.policy);
} }
if ($scope.selectedPolicies) { if ($scope.selectedPolicies) {
policyState.state.selectedPolicies = $scope.selectedPolicies; policyViewState.state.selectedPolicies = $scope.selectedPolicies;
} }
var previousUrl = window.location.href.substring(window.location.href.indexOf('/realms')); var previousUrl = window.location.href.substring(window.location.href.indexOf('/realms'));
if (previousUrl.indexOf('back=true') == -1) { 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"); $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(); $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.policy = angular.copy(policy);
$scope.$watch('policy', function() { $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) { service.save({realm : realm.realm, client : client.id, type: $scope.policy.type}, $scope.policy, function(data) {
if (delegate.isPermission()) { if (delegate.isPermission()) {
if ($scope.historyBackOnSaveOrCancel) { if ($scope.historyBackOnSaveOrCancel || policyViewState.state.rootUrl != null) {
policyState.state.newPolicyName = $scope.policy.name; if (policyViewState.state.rootUrl != null) {
$location.url(policyState.state.previousUrl); $location.url(policyViewState.state.rootUrl);
} else {
policyViewState.state.newPolicyName = $scope.policy.name;
$location.url(policyViewState.state.previousUrl);
}
} else { } else {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/permission/" + $scope.policy.type + "/" + data.id); $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/permission/" + $scope.policy.type + "/" + data.id);
} }
Notifications.success("The permission has been created."); Notifications.success("The permission has been created.");
} else { } else {
if ($scope.historyBackOnSaveOrCancel) { if ($scope.historyBackOnSaveOrCancel) {
policyState.state.newPolicyName = $scope.policy.name; policyViewState.state.newPolicyName = $scope.policy.name;
$location.url(policyState.state.previousUrl); $location.url(policyViewState.state.previousUrl);
} else { } else {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/policy/" + $scope.policy.type + "/" + data.id); $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() { $scope.reset = function() {
if (delegate.isPermission()) { if (delegate.isPermission()) {
if ($scope.historyBackOnSaveOrCancel) { if ($scope.historyBackOnSaveOrCancel || policyViewState.state.rootUrl != null) {
$location.url(policyState.state.previousUrl); if (policyViewState.state.rootUrl != null) {
$location.url(policyViewState.state.rootUrl);
} else {
$location.url(policyViewState.state.previousUrl);
}
} else { } else {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/permission/"); $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/permission/");
} }
} else { } else {
if ($scope.historyBackOnSaveOrCancel) { if ($scope.historyBackOnSaveOrCancel) {
$location.url(policyState.state.previousUrl); $location.url(policyViewState.state.previousUrl);
} else { } else {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/policy/"); $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() { service.update({realm : realm.realm, client : client.id, type: $scope.policy.type, id : $scope.policy.id}, $scope.policy, function() {
if (delegate.isPermission()) { if (delegate.isPermission()) {
if ($scope.historyBackOnSaveOrCancel) { if ($scope.historyBackOnSaveOrCancel) {
$location.url(policyState.state.previousUrl); $location.url(policyViewState.state.previousUrl);
} else { } else {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/permission/" + $scope.policy.type + "/" + $scope.policy.id); $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."); Notifications.success("The permission has been updated.");
} else { } else {
if ($scope.historyBackOnSaveOrCancel) { if ($scope.historyBackOnSaveOrCancel) {
$location.url(policyState.state.previousUrl); $location.url(policyViewState.state.previousUrl);
} else { } else {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/authz/resource-server/policy/" + $scope.policy.type + "/" + $scope.policy.id); $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() { $scope.reset = function() {
if ($scope.historyBackOnSaveOrCancel) { if ($scope.historyBackOnSaveOrCancel) {
$location.url(policyState.state.previousUrl); $location.url(policyViewState.state.previousUrl);
} else { } else {
var freshPolicy = angular.copy(data); var freshPolicy = angular.copy(data);
@ -2402,40 +2420,45 @@ module.service("PolicyController", function($http, $route, $location, ResourceSe
} }
this.restoreState = function($scope) { this.restoreState = function($scope) {
$scope.policy.name = policyState.state.policy.name; $scope.policy.name = policyViewState.state.policy.name;
$scope.policy.description = policyState.state.policy.description; $scope.policy.description = policyViewState.state.policy.description;
$scope.policy.decisionStrategy = policyState.state.policy.decisionStrategy; $scope.policy.decisionStrategy = policyViewState.state.policy.decisionStrategy;
$scope.policy.logic = policyState.state.policy.logic; $scope.policy.logic = policyViewState.state.policy.logic;
$scope.selectedPolicies = policyState.state.selectedPolicies; $scope.selectedPolicies = policyViewState.state.selectedPolicies;
if (!$scope.selectedPolicies) { if (!$scope.selectedPolicies) {
$scope.selectedPolicies = []; $scope.selectedPolicies = [];
} }
$scope.changed = true; $scope.changed = true;
var previousPage = policyState.state.previousPage; var previousPage = policyViewState.state.previousPage;
if (policyState.state.newPolicyName) { if (policyViewState.state.newPolicyName) {
ResourceServerPolicy.query({ ResourceServerPolicy.query({
realm: realm.realm, realm: realm.realm,
client : client.id, client : client.id,
permission: false, permission: false,
name: policyState.state.newPolicyName, name: policyViewState.state.newPolicyName,
max : 20, max : 20,
first : 0 first : 0
}, function(response) { }, function(response) {
for (i = 0; i < response.length; i++) { 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; response[i].text = response[i].name;
$scope.selectedPolicies.push(response[i]); $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 { } else {
policyState.state = {}; var rootUrl = policyViewState.state.rootUrl;
policyState.state.previousPage = previousPage; policyViewState.state = {};
policyViewState.state.previousPage = previousPage;
policyViewState.state.rootUrl = rootUrl;
} }
} }
} }

View file

@ -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 { return {
model: { model: {
state: {} state: {}

View file

@ -41,12 +41,6 @@
</select> </select>
</div> </div>
</div> </div>
<div class="input-group">
<select class="form-control search" data-ng-model="detailsFilter" data-ng-change="searchQuery();">
<option value="" selected>Hide Details</option>
<option value="true">Show Details</option>
</select>
</div>
<div class="pull-right"> <div class="pull-right">
<select class="form-control" ng-model="policyType" <select class="form-control" ng-model="policyType"
ng-options="p.name for p in policyProviders track by p.type" ng-options="p.name for p in policyProviders track by p.type"
@ -59,15 +53,16 @@
</th> </th>
</tr> </tr>
<tr data-ng-hide="policies.length == 0"> <tr data-ng-hide="policies.length == 0">
<th width="1%"></th>
<th>{{:: 'name' | translate}}</th> <th>{{:: 'name' | translate}}</th>
<th>{{:: 'description' | translate}}</th> <th>{{:: 'description' | translate}}</th>
<th>{{:: 'type' | translate}}</th> <th width="7%">{{:: 'type' | translate}}</th>
<th colspan="3">{{:: 'actions' | translate}}</th> <th width="6%" style="text-align: center;">{{:: 'actions' | translate}}</th>
</tr> </tr>
</thead> </thead>
<tfoot data-ng-show="policies && (policies.length >= query.max || query.first > 0)"> <tfoot data-ng-show="policies && (policies.length >= query.max || query.first > 0)">
<tr> <tr>
<td colspan="8"> <td colspan="5">
<div class="table-nav"> <div class="table-nav">
<button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">{{:: 'first-page' | translate}}</button> <button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">{{:: 'first-page' | translate}}</button>
<button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">{{:: 'previous-page' | translate}}</button> <button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">{{:: 'previous-page' | translate}}</button>
@ -77,42 +72,38 @@
</tr> </tr>
</tfoot> </tfoot>
<tbody> <tbody>
<tr ng-repeat-start="policy in policies | filter: {name: search.name, type: search.type} | orderBy:'name'"> <tr ng-repeat-start="policy in policies | filter: {name: search.name, type: search.type} | orderBy:'name'" data-ng-click="showDetails(policy);" style="cursor: pointer">
<td>
<span ng-if="!policy.details || !policy.details.loaded" class="fa fa-angle-right"></span>
<span ng-if="policy.details && policy.details.loaded" class="fa fa-angle-right fa-angle-down"></span>
</td>
<td><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/permission/{{policy.type}}/{{policy.id}}">{{policy.name}}</a></td> <td><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/permission/{{policy.type}}/{{policy.id}}">{{policy.name}}</a></td>
<td>{{policy.description}}</td> <td>{{policy.description}}</td>
<td>{{policy.type}}</td> <td>{{policy.type}}</td>
<td ng-if="!policy.details.loaded" class="kc-action-cell" data-ng-click="showDetails(policy);"> <td align="center">
{{:: 'authz-show-details' | translate}} <div class="dropdown dropdown-kebab-pf">
</td> <button class="btn btn-default" ng-click="delete(policy);">{{:: 'delete' | translate}}
<td ng-if="policy.details.loaded" class="kc-action-cell" data-ng-click="showDetails(policy);"> </button>
{{:: 'authz-hide-details' | translate}} </div>
</td>
<td class="kc-action-cell" ng-click="delete(policy);">
{{:: 'delete' | translate}}
</td> </td>
</tr> </tr>
<tr ng-if="policy.details && policy.details.loaded" ng-repeat-end=""> <tr ng-if="policy.details && policy.details.loaded" ng-repeat-end="">
<td colspan="5"> <td colspan="5" style="background-color: #ffffff">
<div id="details"> <div class="list-group-item-container container-fluid">
<table class="table kc-authz-table-expanded table-striped"> <div class="close" data-ng-click="showDetails(policy);" style="padding-top: 10px">
<thead> <span class="pficon pficon-close"></span>
<tr> </div>
<th>Associated Policies</th> <div class="row">
</tr> <div class="col-md-12">
</thead> <dl class="dl-horizontal">
<tbody> <dt>{{:: 'authz-associated-policies' | translate}}</dt>
<tr> <dd>
<td> <span data-ng-show="policy.associatedPolicies && !policy.associatedPolicies.length">{{:: 'authz-no-policies-available' | translate}}</span>
<span data-ng-show="policy.associatedPolicies && !policy.associatedPolicies.length">{{:: 'authz-no-permission-assigned' | translate}}</span> <span ng-repeat="dep in policy.associatedPolicies" data-ng-show="policy.associatedPolicies.length > 0"><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/{{dep.type == 'scope' || dep.type == 'resource' ? 'permission' : 'policy'}}/{{dep.type}}/{{dep.id}}">{{dep.name}}</a>{{$last ? '' : ', '}}</span>
<ul ng-repeat="dep in policy.associatedPolicies" data-ng-show="policy.associatedPolicies.length > 0"> </dd>
<li> </dl>
<a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/policy/{{dep.type}}/{{dep.id}}">{{dep.name}}</a> </div>
</li> </div>
</ul>
</td>
</tr>
</tbody>
</table>
</div> </div>
</td> </td>
</tr> </tr>

View file

@ -40,16 +40,8 @@
<option value="" selected ng-click="query.type = ''">{{:: 'authz-all-types' | translate}}</option> <option value="" selected ng-click="query.type = ''">{{:: 'authz-all-types' | translate}}</option>
</select> </select>
</div> </div>
<div class="input-group">
<select class="form-control search" data-ng-model="detailsFilter" data-ng-change="searchQuery();">
<option value="" selected>Hide Details</option>
<option value="true">Show Details</option>
</select>
</div>
</div> </div>
<div class="pull-right"> <div class="pull-right">
<a id="hideDetails" data-ng-show="showDetailsFlag" class="btn btn-default" data-ng-click="showDetailsFlag = !showDetailsFlag;showDetails();" href="">{{:: 'authz-hide-details' | translate}}</a>
<a id="showDetails" data-ng-hide="showDetailsFlag" class="btn btn-default" data-ng-click="showDetailsFlag = !showDetailsFlag;showDetails();" href="">{{:: 'authz-show-details' | translate}}</a>
<select id="create-policy" class="form-control" ng-model="policyType" <select id="create-policy" class="form-control" ng-model="policyType"
ng-options="p.name for p in policyProviders track by p.type" ng-options="p.name for p in policyProviders track by p.type"
data-ng-change="addPolicy(policyType);"> data-ng-change="addPolicy(policyType);">
@ -60,15 +52,16 @@
</th> </th>
</tr> </tr>
<tr data-ng-hide="policies.length == 0"> <tr data-ng-hide="policies.length == 0">
<th width="1%"></th>
<th>{{:: 'name' | translate}}</th> <th>{{:: 'name' | translate}}</th>
<th>{{:: 'description' | translate}}</th> <th>{{:: 'description' | translate}}</th>
<th>{{:: 'type' | translate}}</th> <th width="7%">{{:: 'type' | translate}}</th>
<th colspan="3">{{:: 'actions' | translate}}</th> <th width="6%" style="text-align: center;">{{:: 'actions' | translate}}</th>
</tr> </tr>
</thead> </thead>
<tfoot data-ng-show="policies && (policies.length >= query.max || query.first > 0)"> <tfoot data-ng-show="policies && (policies.length >= query.max || query.first > 0)">
<tr> <tr>
<td colspan="8"> <td colspan="5">
<div class="table-nav"> <div class="table-nav">
<button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">{{:: 'first-page' | translate}}</button> <button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">{{:: 'first-page' | translate}}</button>
<button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">{{:: 'previous-page' | translate}}</button> <button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">{{:: 'previous-page' | translate}}</button>
@ -78,42 +71,38 @@
</tr> </tr>
</tfoot> </tfoot>
<tbody> <tbody>
<tr ng-repeat-start="policy in policies | filter: {name: search.name, type: search.type} | orderBy:'name'"> <tr ng-repeat-start="policy in policies | filter: {name: search.name, type: search.type} | orderBy:'name'" data-ng-click="showDetails(policy);" style="cursor: pointer">
<td>
<span ng-if="!policy.details || !policy.details.loaded" class="fa fa-angle-right"></span>
<span ng-if="policy.details && policy.details.loaded" class="fa fa-angle-right fa-angle-down"></span>
</td>
<td><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/policy/{{policy.type}}/{{policy.id}}">{{policy.name}}</a></td> <td><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/policy/{{policy.type}}/{{policy.id}}">{{policy.name}}</a></td>
<td>{{policy.description}}</td> <td>{{policy.description}}</td>
<td>{{policy.type}}</td> <td>{{policy.type}}</td>
<td ng-if="!policy.details.loaded" class="kc-action-cell" data-ng-click="showDetails(policy);"> <td align="center">
{{:: 'authz-show-details' | translate}} <div class="dropdown dropdown-kebab-pf">
</td> <button class="btn btn-default" ng-click="delete(policy);">{{:: 'delete' | translate}}
<td ng-if="policy.details.loaded" class="kc-action-cell" data-ng-click="showDetails(policy);"> </button>
{{:: 'authz-hide-details' | translate}} </div>
</td>
<td class="kc-action-cell" ng-click="delete(policy);">
{{:: 'delete' | translate}}
</td> </td>
</tr> </tr>
<tr ng-if="policy.details && policy.details.loaded" ng-repeat-end=""> <tr ng-if="policy.details && policy.details.loaded" ng-repeat-end="">
<td colspan="5"> <td colspan="5" style="background-color: #ffffff">
<div id="details"> <div class="list-group-item-container container-fluid">
<table class="table kc-authz-table-expanded table-striped"> <div class="close" data-ng-click="showDetails(policy);" style="padding-top: 10px">
<thead> <span class="pficon pficon-close"></span>
<tr> </div>
<th>Dependent Permissions and Policies</th> <div class="row">
</tr> <div class="col-md-12">
</thead> <dl class="dl-horizontal">
<tbody> <dt>Dependent Policies</dt>
<tr> <dd>
<td> <span data-ng-show="policy.dependentPolicies && !policy.dependentPolicies.length">{{:: 'authz-no-policies-available' | translate}}</span>
<span data-ng-show="policy.dependentPolicies && !policy.dependentPolicies.length">{{:: 'authz-no-permission-assigned' | translate}}</span> <span ng-repeat="dep in policy.dependentPolicies" data-ng-show="policy.dependentPolicies.length > 0"><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/{{dep.type == 'scope' || dep.type == 'resource' ? 'permission' : 'policy'}}/{{dep.type}}/{{dep.id}}">{{dep.name}}</a>{{$last ? '' : ', '}}</span>
<ul ng-repeat="dep in policy.dependentPolicies" data-ng-show="policy.dependentPolicies.length > 0"> </dd>
<li> </dl>
<a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/{{dep.type == 'scope' || dep.type == 'resource' ? 'permission' : 'policy'}}/{{dep.type}}/{{dep.id}}">{{dep.name}}</a> </div>
</li> </div>
</ul>
</td>
</tr>
</tbody>
</table>
</div> </div>
</td> </td>
</tr> </tr>

View file

@ -3,8 +3,10 @@
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="#/realms/{{realm.realm}}/clients">{{:: 'clients' | translate}}</a></li> <li><a href="#/realms/{{realm.realm}}/clients">{{:: 'clients' | translate}}</a></li>
<li><a href="#/realms/{{realm.realm}}/clients/{{client.id}}">{{client.clientId}}</a></li> <li><a href="#/realms/{{realm.realm}}/clients/{{client.id}}">{{client.clientId}}</a></li>
<li><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server">{{:: 'authz-authorization' | translate}}</a></li> <li><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server">{{:: 'authz-authorization' |
<li><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/resource">{{:: 'authz-resources' | translate}}</a></li> translate}}</a></li>
<li><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/resource">{{::
'authz-resources' | translate}}</a></li>
</ol> </ol>
<kc-tabs-resource-server></kc-tabs-resource-server> <kc-tabs-resource-server></kc-tabs-resource-server>
@ -12,75 +14,95 @@
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">
<thead> <thead>
<tr> <tr>
<th class="kc-table-actions" colspan="7"> <th class="kc-table-actions" colspan="6">
<div class="form-inline"> <div class="form-inline">
{{:: 'filter' | translate}}:&nbsp;&nbsp; {{:: 'filter' | translate}}:&nbsp;&nbsp;
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<input type="text" placeholder="{{:: 'name' | translate}}" data-ng-model="query.name" class="form-control search" onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()"> <input type="text" placeholder="{{:: 'name' | translate}}" data-ng-model="query.name"
class="form-control search"
onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()">
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-search" id="resourceSearch" type="submit" data-ng-click="firstPage()"></i> <i class="fa fa-search" id="resourceSearch" type="submit"
data-ng-click="firstPage()"></i>
</div> </div>
</div> </div>
<div class="input-group"> <div class="input-group">
<input type="text" placeholder="{{:: 'type' | translate}}" data-ng-model="query.type" class="form-control search" onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()"> <input type="text" placeholder="{{:: 'type' | translate}}" data-ng-model="query.type"
class="form-control search"
onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()">
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-search" type="submit" data-ng-click="firstPage()"></i> <i class="fa fa-search" type="submit" data-ng-click="firstPage()"></i>
</div> </div>
</div> </div>
<div class="input-group"> <div class="input-group">
<input type="text" placeholder="{{:: 'authz-uri' | translate}}" data-ng-model="query.uri" class="form-control search" onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()"> <input type="text" placeholder="{{:: 'authz-uri' | translate}}" data-ng-model="query.uri"
class="form-control search"
onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()">
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-search" type="submit" data-ng-click="firstPage()"></i> <i class="fa fa-search" type="submit" data-ng-click="firstPage()"></i>
</div> </div>
</div> </div>
<div class="input-group"> <div class="input-group">
<input type="text" placeholder="{{:: 'authz-owner' | translate}}" data-ng-model="query.owner" class="form-control search" onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()"> <input type="text" placeholder="{{:: 'authz-owner' | translate}}"
data-ng-model="query.owner" class="form-control search"
onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()">
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-search" type="submit" data-ng-click="firstPage()"></i> <i class="fa fa-search" type="submit" data-ng-click="firstPage()"></i>
</div> </div>
</div> </div>
<div class="input-group"> <div class="input-group">
<input type="text" placeholder="{{:: 'authz-scope' | translate}}" data-ng-model="query.scope" class="form-control search" onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()"> <input type="text" placeholder="{{:: 'authz-scope' | translate}}"
data-ng-model="query.scope" class="form-control search"
onkeydown="if (event.keyCode == 13) document.getElementById('resourceSearch').click()">
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-search" type="submit" data-ng-click="firstPage()"></i> <i class="fa fa-search" type="submit" data-ng-click="firstPage()"></i>
</div> </div>
</div> </div>
<div class="input-group">
<select class="form-control search" data-ng-model="detailsFilter" data-ng-change="searchQuery();">
<option value="" selected>Hide Details</option>
<option value="true">Show Details</option>
</select>
</div>
</div> </div>
<div class="pull-right"> <div class="pull-right">
<a id="createResource" class="btn btn-default" href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/resource/create">{{:: 'create' | translate}}</a> <a id="createResource" class="btn btn-default"
href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/resource/create">{{::
'create' | translate}}</a>
</div> </div>
</div> </div>
</th> </th>
</tr> </tr>
<tr data-ng-hide="resources.length == 0"> <tr data-ng-hide="resources.length == 0">
<th width="1%"></th>
<th>{{:: 'name' | translate}}</th> <th>{{:: 'name' | translate}}</th>
<th>{{:: 'type' | translate}}</th> <th>{{:: 'type' | translate}}</th>
<th>{{:: 'authz-uri' | translate}}</th> <th>{{:: 'authz-uri' | translate}}</th>
<th>{{:: 'authz-owner' | translate}}</th> <th>{{:: 'authz-owner' | translate}}</th>
<th colspan="3">{{:: 'actions' | translate}}</th> <th width="11%" style="text-align: center">{{:: 'actions' | translate}}</th>
</tr> </tr>
</thead> </thead>
<tfoot data-ng-show="resources && (resources.length >= query.max || query.first > 0)"> <tfoot data-ng-show="resources && (resources.length >= query.max || query.first > 0)">
<tr> <tr>
<td colspan="7"> <td colspan="6">
<div class="table-nav"> <div class="table-nav">
<button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">{{:: 'first-page' | translate}}</button> <button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">{{:: 'first-page' |
<button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">{{:: 'previous-page' | translate}}</button> translate}}
<button data-ng-click="nextPage()" class="next" ng-disabled="resources.length < query.max">{{:: 'next-page' | translate}}</button> </button>
<button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">{{::
'previous-page' | translate}}
</button>
<button data-ng-click="nextPage()" class="next" ng-disabled="resources.length < query.max">{{::
'next-page' | translate}}
</button>
</div> </div>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
<tbody> <tbody>
<tr ng-repeat-start="resource in resources | filter:search | orderBy:'name'"> <tr ng-repeat-start="resource in resources | filter:search | orderBy:'name'" data-ng-click="showDetails(resource);" style="cursor: pointer;">
<td><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/resource/{{resource._id}}">{{resource.name}}</a></td> <td>
<span ng-if="!resource.details || !resource.details.loaded" class="fa fa-angle-right"></span>
<span ng-if="resource.details && resource.details.loaded" class="fa fa-angle-right fa-angle-down"></span>
</td>
<td>
<a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/resource/{{resource._id}}">{{resource.name}}</a>
</td>
<td> <td>
<span data-ng-show="resource.type">{{resource.type}}</span> <span data-ng-show="resource.type">{{resource.type}}</span>
<span data-ng-show="!resource.type">{{:: 'authz-no-type-defined' | translate}}</span> <span data-ng-show="!resource.type">{{:: 'authz-no-type-defined' | translate}}</span>
@ -90,56 +112,49 @@
<span data-ng-show="!resource.uri">{{:: 'authz-no-uri-defined' | translate}}</span> <span data-ng-show="!resource.uri">{{:: 'authz-no-uri-defined' | translate}}</span>
</td> </td>
<td>{{resource.owner.name}}</td> <td>{{resource.owner.name}}</td>
<td ng-if="!resource.details.loaded" class="kc-action-cell" data-ng-click="showDetails(resource);"> <td align="center">
{{:: 'authz-show-details' | translate}} <div class="dropdown dropdown-kebab-pf">
</td> <button class="btn btn-default" ng-click="createPolicy(resource);">{{:: 'authz-create-permission' | translate}}
<td ng-if="resource.details.loaded" class="kc-action-cell" data-ng-click="showDetails(resource);"> </button>
{{:: 'authz-hide-details' | translate}} <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"
</td> aria-haspopup="true" aria-expanded="true">
<td class="kc-action-cell" ng-click="createPolicy(resource);"> <span class="fa fa-ellipsis-v"></span></button>
{{:: 'authz-create-permission' | translate}} <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownKebabRight">
</td> <li><a href="" ng-click="delete(resource);">{{:: 'delete' | translate}}</a></li>
<td class="kc-action-cell" ng-click="delete(resource);"> </ul>
{{:: 'delete' | translate}} </div>
</td> </td>
</tr> </tr>
<tr ng-if="resource.details && resource.details.loaded" ng-repeat-end=""> <tr ng-if="resource.details && resource.details.loaded" ng-repeat-end="">
<td colspan="7"> <td colspan="6" style="background-color: #ffffff">
<div id="details"> <div class="list-group-item-container container-fluid">
<table class="table kc-authz-table-expanded table-striped"> <div class="close" data-ng-click="showDetails(resource);" style="padding-top: 10px">
<thead> <span class="pficon pficon-close"></span>
<tr> </div>
<th>Scopes</th> <div class="row">
<th>Associated Permissions</th> <div class="col-md-12">
</tr> <dl class="dl-horizontal">
</thead> <dt>{{:: 'authz-scopes' | translate}}</dt>
<tbody> <dd>
<tr>
<td>
<span data-ng-show="resource.scopes && !resource.scopes.length">{{:: 'authz-no-scopes-assigned' | translate}}</span> <span data-ng-show="resource.scopes && !resource.scopes.length">{{:: 'authz-no-scopes-assigned' | translate}}</span>
<ul ng-repeat="scope in resource.scopes" data-ng-show="resource.scopes.length > 0"> <span ng-repeat="scope in resource.scopes" data-ng-show="resource.scopes.length > 0"><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/scope/{{scope.id}}">{{scope.name}}</a>{{$last ? '' : ', '}} </span>
<li> </dd>
<a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/scope/{{scope.id}}">{{scope.name}}</a> <dt>{{:: 'authz-associated-permissions' | translate}}</dt>
</li> <dd>
</ul>
</td>
<td>
<span data-ng-show="resource.policies && !resource.policies.length">{{:: 'authz-no-permission-assigned' | translate}}</span> <span data-ng-show="resource.policies && !resource.policies.length">{{:: 'authz-no-permission-assigned' | translate}}</span>
<ul ng-repeat="policy in resource.policies" data-ng-show="resource.policies.length > 0"> <span ng-repeat="policy in resource.policies" data-ng-show="resource.policies.length > 0"><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/permission/{{policy.type}}/{{policy.id}}">{{policy.name}}</a>{{$last ? '' : ', '}}</span>
<li> </dd>
<a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/permission/{{policy.type}}/{{policy.id}}">{{policy.name}}</a> </dl>
</li> </div>
</ul> </div>
</td>
</tr>
</tbody>
</table>
</div> </div>
</td> </td>
</tr> </tr>
<tr data-ng-show="(resources | filter:search).length == 0"> <tr data-ng-show="(resources | filter:search).length == 0">
<td class="text-muted" colspan="6" data-ng-show="search.name">{{:: 'no-results' | translate}}</td> <td class="text-muted" colspan="6" data-ng-show="search.name">{{:: 'no-results' | translate}}</td>
<td class="text-muted" colspan="6" data-ng-hide="search.name">{{:: 'authz-no-resources-available' | translate}}</td> <td class="text-muted" colspan="6" data-ng-hide="search.name">{{:: 'authz-no-resources-available' |
translate}}
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View file

@ -12,7 +12,7 @@
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">
<thead> <thead>
<tr> <tr>
<th class="kc-table-actions" colspan="5"> <th class="kc-table-actions" colspan="3">
<div class="form-inline"> <div class="form-inline">
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
@ -21,12 +21,6 @@
<i class="fa fa-search" id="scopeSearch" type="submit" data-ng-click="firstPage()"></i> <i class="fa fa-search" id="scopeSearch" type="submit" data-ng-click="firstPage()"></i>
</div> </div>
</div> </div>
<div class="input-group">
<select class="form-control search" data-ng-model="detailsFilter" data-ng-change="showDetails();">
<option value="" selected>Hide Details</option>
<option value="true">Show Details</option>
</select>
</div>
</div> </div>
<div class="pull-right"> <div class="pull-right">
<a id="createScope" class="btn btn-default" href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/scope/create">{{:: 'create' | translate}}</a> <a id="createScope" class="btn btn-default" href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/scope/create">{{:: 'create' | translate}}</a>
@ -35,13 +29,14 @@
</th> </th>
</tr> </tr>
<tr data-ng-hide="scopes.length == 0"> <tr data-ng-hide="scopes.length == 0">
<th width="1%"></th>
<th>{{:: 'name' | translate}}</th> <th>{{:: 'name' | translate}}</th>
<th colspan="3">{{:: 'actions' | translate}}</th> <th width="11%" style="text-align: center">{{:: 'actions' | translate}}</th>
</tr> </tr>
</thead> </thead>
<tfoot data-ng-show="scopes && (scopes.length >= query.max || query.first > 0)"> <tfoot data-ng-show="scopes && (scopes.length >= query.max || query.first > 0)">
<tr> <tr>
<td colspan="8"> <td colspan="3">
<div class="table-nav"> <div class="table-nav">
<button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">{{:: 'first-page' | translate}}</button> <button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">{{:: 'first-page' | translate}}</button>
<button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">{{:: 'previous-page' | translate}}</button> <button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">{{:: 'previous-page' | translate}}</button>
@ -51,52 +46,48 @@
</tr> </tr>
</tfoot> </tfoot>
<tbody> <tbody>
<tr ng-repeat-start="scope in scopes | filter:search | orderBy:'name'"> <tr ng-repeat-start="scope in scopes | filter:search | orderBy:'name'" data-ng-click="showDetails(scope);" style="cursor: pointer">
<td width="70%"><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/scope/{{scope.id}}">{{scope.name}}</a></td> <td>
<td ng-if="!scope.details.loaded" class="kc-action-cell" data-ng-click="showDetails(scope);"> <span ng-if="!scope.details || !scope.details.loaded" class="fa fa-angle-right"></span>
{{:: 'authz-show-details' | translate}} <span ng-if="scope.details && scope.details.loaded" class="fa fa-angle-right fa-angle-down"></span>
</td> </td>
<td ng-if="scope.details.loaded" class="kc-action-cell" data-ng-click="showDetails(scope);"> <td><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/scope/{{scope.id}}">{{scope.name}}</a></td>
{{:: 'authz-hide-details' | translate}} <td align="center">
</td> <div class="dropdown dropdown-kebab-pf">
<td class="kc-action-cell" ng-click="createPolicy(scope);"> <button class="btn btn-default" ng-click="createPolicy(scope);">{{:: 'authz-create-permission' |
{{:: 'authz-create-permission' | translate}} translate}}
</td> </button>
<td class="kc-action-cell" ng-click="delete(scope);"> <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"
{{:: 'delete' | translate}} aria-haspopup="true" aria-expanded="true">
<span class="fa fa-ellipsis-v"></span></button>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownKebabRight">
<li><a href="" ng-click="delete(scope);">{{:: 'delete' | translate}}</a></li>
</ul>
</div>
</td> </td>
</tr> </tr>
<tr ng-if="scope.details && scope.details.loaded" ng-repeat-end=""> <tr ng-if="scope.details && scope.details.loaded" ng-repeat-end="">
<td colspan="4"> <td colspan="3" style="background-color: #ffffff">
<div id="details"> <div class="list-group-item-container container-fluid">
<table class="table kc-authz-table-expanded table-striped"> <div class="close" data-ng-click="showDetails(scope);" style="padding-top: 10px">
<thead> <span class="pficon pficon-close"></span>
<tr> </div>
<th>Resources</th> <div class="row">
<th>Associated Permissions</th> <div class="col-md-12">
</tr> <dl class="dl-horizontal">
</thead> <dt>{{:: 'authz-resources' | translate}}</dt>
<tbody> <dd>
<tr>
<td>
<span data-ng-show="scope.resources && !scope.resources.length">{{:: 'authz-no-resources-assigned' | translate}}</span> <span data-ng-show="scope.resources && !scope.resources.length">{{:: 'authz-no-resources-assigned' | translate}}</span>
<ul ng-repeat="resource in scope.resources" data-ng-show="scope.resources.length > 0"> <span ng-repeat="resource in scope.resources" data-ng-show="scope.resources.length > 0"><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/resource/{{resource._id}}">{{resource.name}}</a>{{$last ? '' : ', '}}</span>
<li> </dd>
<a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/resource/{{resource._id}}">{{resource.name}}</a> <dt>{{:: 'authz-associated-permissions' | translate}}</dt>
</li> <dd>
</ul>
</td>
<td>
<span data-ng-show="scope.policies && !scope.policies.length">{{:: 'authz-no-permission-assigned' | translate}}</span> <span data-ng-show="scope.policies && !scope.policies.length">{{:: 'authz-no-permission-assigned' | translate}}</span>
<ul ng-repeat="policy in scope.policies" data-ng-show="scope.policies.length > 0"> <span ng-repeat="policy in scope.policies" data-ng-show="scope.policies.length > 0"><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/permission/{{policy.type}}/{{policy.id}}">{{policy.name}}</a>{{$last ? '' : ', '}}</span>
<li> </dd>
<a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/permission/{{policy.type}}/{{policy.id}}">{{policy.name}}</a> </dl>
</li> </div>
</ul> </div>
</td>
</tr>
</tbody>
</table>
</div> </div>
</td> </td>
</tr> </tr>