in src/main/java/org/apache/sling/starter/access/models/Acl.java [45:77]
public Collection<PrincipalPrivilege> getPrincipals() throws RepositoryException {
if (principalPrivilegeList == null) {
principalPrivilegeList = new ArrayList<>();
Session jcrSession = request.getResourceResolver().adaptTo(Session.class);
PrincipalManager principalManager = ((JackrabbitSession)jcrSession).getPrincipalManager();
JsonObject acl = getAcl.getAcl(jcrSession, resource.getPath());
for (Entry<String, JsonValue> entry : acl.entrySet()) {
String uid = entry.getKey();
Principal principal = principalManager.getPrincipal(uid);
if (principal != null) {
PrincipalPrivilege pi = new PrincipalPrivilege(principal);
AtomicBoolean allow = new AtomicBoolean(false);
AtomicBoolean deny = new AtomicBoolean(false);
JsonObject privilegesObj = ((JsonObject)entry.getValue()).getJsonObject("privileges");
privilegesObj.values().stream()
.forEach(item -> {
allow.set(allow.get() || ((JsonObject)item).containsKey("allow"));
deny.set(deny.get() || ((JsonObject)item).containsKey("deny"));
});
if (allow.get()) {
pi.setAllow(true);
}
if (deny.get()) {
pi.setDeny(true);
}
principalPrivilegeList.add(pi);
}
}
}
return principalPrivilegeList;
}