Skip to content

Commit

Permalink
fix: corrected ORestricted case for count operations in new query engine
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Aug 16, 2024
1 parent a184e8d commit d0fbf9e
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.orientechnologies.orient.core.index.OIndexDefinition;
import com.orientechnologies.orient.core.metadata.OMetadataInternal;
import com.orientechnologies.orient.core.metadata.schema.OClass;
import com.orientechnologies.orient.core.metadata.schema.OImmutableClass;
import com.orientechnologies.orient.core.metadata.schema.OProperty;
import com.orientechnologies.orient.core.metadata.schema.OSchema;
import com.orientechnologies.orient.core.metadata.schema.OType;
Expand Down Expand Up @@ -653,13 +654,17 @@ private boolean handleHardwiredCountOnClass(
private boolean securityPoliciesExistForClass(OIdentifier targetClass, OCommandContext ctx) {
ODatabaseDocumentInternal db = (ODatabaseDocumentInternal) ctx.getDatabase();
OSecurityInternal security = db.getSharedContext().getSecurity();
OClass clazz =
db.getMetadata()
.getImmutableSchemaSnapshot()
.getClass(targetClass.getStringValue()); // normalize class name case
OImmutableClass clazz =
(OImmutableClass)
db.getMetadata()
.getImmutableSchemaSnapshot()
.getClass(targetClass.getStringValue()); // normalize class name case
if (clazz == null) {
return false;
}
if (clazz.isRestricted()) {
return true;
}
return security.isReadRestrictedBySecurityPolicy(
(ODatabaseSession) db, "database.class." + clazz.getName());
}
Expand Down

0 comments on commit d0fbf9e

Please sign in to comment.