Skip to content

Commit 8d3e806

Browse files
committed
Avoid fetching vertex for abac evaluation
1 parent 8b4eee9 commit 8d3e806

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

repository/src/main/java/org/apache/atlas/authorizer/authorizers/EntityAuthorizer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ private static AtlasAccessResult isAccessAllowedInMemory(AtlasEntityHeader entit
7878
private static AtlasAccessResult evaluateABACPoliciesInMemory(List<RangerPolicy> abacPolicies, AtlasEntityHeader entity) {
7979
AtlasAccessResult result = new AtlasAccessResult(false);
8080

81-
AtlasVertex vertex = AtlasGraphUtilsV2.findByGuid(entity.getGuid());
81+
// might have to fetch vertex when support for more attributes is added, so not removing the argument but setting to null for now
82+
AtlasVertex vertex = null; // AtlasGraphUtilsV2.findByGuid(entity.getGuid());
83+
LOG.info("ABAC_AUTH: Attributes present in entity={} attrs={}", entity.getAttribute(ATTR_QUALIFIED_NAME), entity.getAttributes() == null ? "null" : entity.getAttributes().keySet());
8284

8385
for (RangerPolicy policy : abacPolicies) {
8486
boolean matched = false;
@@ -293,19 +295,19 @@ private static List<String> getAttributeValue(AtlasEntityHeader entity, String a
293295
for (String relatedAttribute : relatedAttributes) {
294296
Object attrValue = entity.getAttribute(relatedAttribute);
295297
if (attrValue != null) {
296-
LOG.info("ABAC_AUTH: Attribute found in entity attr={} entityId={}", relatedAttribute, entity.getAttribute(ATTR_QUALIFIED_NAME));
298+
LOG.info("ABAC_AUTH: Attribute found in entity attr={} qn={}", relatedAttribute, entity.getAttribute(ATTR_QUALIFIED_NAME));
297299
if (attrValue instanceof Collection) {
298300
entityAttributeValues.addAll((Collection<? extends String>) attrValue);
299301
} else {
300302
entityAttributeValues.add(String.valueOf(attrValue));
301303
}
302304
} else if (vertex != null) {
303-
LOG.info("ABAC_AUTH: Attribute not found in entity, checking vertex attr={} entityId={}", relatedAttribute, entity.getAttribute(ATTR_QUALIFIED_NAME));
304305
// try fetching from vertex
305306
Collection<?> values = vertex.getPropertyValues(relatedAttribute, String.class);
306307
for (Object value : values) {
307308
entityAttributeValues.add(String.valueOf(value));
308309
}
310+
LOG.info("ABAC_AUTH: Attribute not found in entity, checking vertex attr={} qn={} value={}", relatedAttribute, entity.getAttribute(ATTR_QUALIFIED_NAME), values);
309311
}
310312
}
311313
return entityAttributeValues;

0 commit comments

Comments
 (0)