@Override
protected void onSuccess(final ModelNode result) {
List<ModelNode> roleMappings = result.get(RESULT).asList();
for (ModelNode node : roleMappings) {
Property property = node.asProperty();
String roleName = property.getName();
if (name != null) {
if (name.equals(roleName)) {
matchingRoles.add(roleName);
break;
}
} else {
// check if the role is empty and does not have include-all=true
boolean match = true;
ModelNode assignmentNode = property.getValue();
if (assignmentNode.hasDefined("include-all")) {
match = !assignmentNode.get("include-all").asBoolean();
}
if (match) {
if (assignmentNode.hasDefined("include")) {