grantedRoles.remove(role);
ungrantedRoles.add(role.substring(1));
}
}
Group subjectRoles = getRolesGroup(subject);
if (subjectRoles != null) {
boolean granted = false;
if (!grantedRoles.isEmpty()) {
for (String grantedRole : grantedRoles) {
if (subjectRoles.isMember(new SimplePrincipal(grantedRole))) {
granted = true;
break;
}
}
}
if (!granted && !ungrantedRoles.isEmpty()) {
granted = true;
for (String ungrantedRole : ungrantedRoles) {
if (subjectRoles.isMember(new SimplePrincipal(ungrantedRole))) {
granted = false;
break;
}
}
}