Skip to content

Commit

Permalink
Optimise predicate security checks on property validation
Browse files Browse the repository at this point in the history
  • Loading branch information
luigidellaquila committed May 18, 2021
1 parent e2f352d commit f0029b1
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,20 @@ public boolean isAllowedWrite(ODatabaseSession session, ODocument document, Stri
if (clazz == null) {
return true;
}
String className = clazz.getName();

if (roleHasPredicateSecurityForClass != null) {
for (OSecurityRole role : session.getUser().getRoles()) {
Map<String, Boolean> roleMap = roleHasPredicateSecurityForClass.get(role.getName());
if (roleMap == null) {
return true; // TODO hierarchy...?
}
Boolean val = roleMap.get(className);
if (!(Boolean.TRUE.equals(val))) {
return true; // TODO hierarchy...?
}
}
}

if (document.getIdentity().isNew()) {
OBooleanExpression predicate =
Expand Down

0 comments on commit f0029b1

Please sign in to comment.