use of org.keycloak.representations.idm.authorization.PolicyRepresentation in project keycloak by keycloak.
the class PermissionsTable method toRepresentation.
public PolicyRepresentation toRepresentation(WebElement row) {
PolicyRepresentation representation = null;
List<WebElement> tds = row.findElements(tagName("td"));
if (!(tds.isEmpty() || getTextFromElement(tds.get(1)).isEmpty())) {
representation = new PolicyRepresentation();
representation.setName(getTextFromElement(tds.get(1)));
representation.setDescription(getTextFromElement(tds.get(2)));
representation.setType(getTextFromElement(tds.get(3)));
}
return representation;
}
use of org.keycloak.representations.idm.authorization.PolicyRepresentation in project keycloak by keycloak.
the class Policies method delete.
public void delete(String name) {
for (WebElement row : policies().rows()) {
PolicyRepresentation actual = policies().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
clickLink(row.findElements(tagName("a")).get(0));
String type = actual.getType();
if ("role".equals(type)) {
rolePolicy.form().delete();
} else if ("user".equals(type)) {
userPolicy.form().delete();
} else if ("aggregate".equals(type)) {
aggregatePolicy.form().delete();
} else if ("js".equals(type)) {
jsPolicy.form().delete();
} else if ("time".equals(type)) {
timePolicy.form().delete();
} else if ("client".equals(type)) {
clientPolicy.form().delete();
} else if ("group".equals(type)) {
groupPolicy.form().delete();
}
return;
}
}
}
use of org.keycloak.representations.idm.authorization.PolicyRepresentation in project keycloak by keycloak.
the class Policies method update.
public void update(String name, AbstractPolicyRepresentation representation) {
for (WebElement row : policies().rows()) {
PolicyRepresentation actual = policies().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
clickLink(row.findElements(tagName("a")).get(0));
String type = representation.getType();
if ("role".equals(type)) {
rolePolicy.form().populate((RolePolicyRepresentation) representation, true);
} else if ("user".equals(type)) {
userPolicy.form().populate((UserPolicyRepresentation) representation, true);
} else if ("aggregate".equals(type)) {
aggregatePolicy.form().populate((AggregatePolicyRepresentation) representation, true);
} else if ("js".equals(type)) {
jsPolicy.form().populate((JSPolicyRepresentation) representation, true);
} else if ("time".equals(type)) {
timePolicy.form().populate((TimePolicyRepresentation) representation, true);
} else if ("client".equals(type)) {
clientPolicy.form().populate((ClientPolicyRepresentation) representation, true);
} else if ("group".equals(type)) {
groupPolicy.form().populate((GroupPolicyRepresentation) representation, true);
}
return;
}
}
}
use of org.keycloak.representations.idm.authorization.PolicyRepresentation in project keycloak by keycloak.
the class Permissions method update.
public void update(String name, AbstractPolicyRepresentation representation, boolean save) {
for (WebElement row : permissions().rows()) {
PolicyRepresentation actual = permissions().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
clickLink(row.findElements(tagName("a")).get(0));
WaitUtils.waitForPageToLoad();
String type = representation.getType();
if ("resource".equals(type)) {
resourcePermission.form().populate((ResourcePermissionRepresentation) representation, save);
} else if ("scope".equals(type)) {
scopePermission.form().populate((ScopePermissionRepresentation) representation, save);
}
return;
}
}
}
use of org.keycloak.representations.idm.authorization.PolicyRepresentation in project keycloak by keycloak.
the class Permissions method deleteFromList.
public void deleteFromList(String name) {
for (WebElement row : permissions().rows()) {
PolicyRepresentation actual = permissions().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
row.findElements(tagName("td")).get(4).click();
modalDialog.confirmDeletion();
return;
}
}
}
Aggregations