diff --git a/repository/src/main/java/org/apache/atlas/authorizer/authorizers/ListAuthorizer.java b/repository/src/main/java/org/apache/atlas/authorizer/authorizers/ListAuthorizer.java index fbd73c54b6..227a09aa52 100644 --- a/repository/src/main/java/org/apache/atlas/authorizer/authorizers/ListAuthorizer.java +++ b/repository/src/main/java/org/apache/atlas/authorizer/authorizers/ListAuthorizer.java @@ -254,19 +254,24 @@ public static List> getDSLForResourcePoliciesPerPolicy(List< List> shouldClauses = new ArrayList<>(); for (RangerPolicy policy : policies) { - if (!policy.getResources().isEmpty() && "ENTITY".equals(policy.getPolicyResourceCategory())) { - List entities = policy.getResources().get("entity").getValues(); - List entityTypesRaw = policy.getResources().get("entity-type").getValues(); + if (!policy.getResources().isEmpty()) { + RangerPolicy.RangerPolicyResource resourceEntity = policy.getResources().get("entity"); + RangerPolicy.RangerPolicyResource resourceTypes = policy.getResources().get("entity-type"); - if (entities.contains("*") && entityTypesRaw.contains("*")) { - shouldClauses.clear(); - shouldClauses.add(getMap("match_all", getMap("_name", policy.getGuid() + getPolicySuffix(policy)))); - break; - } + if (resourceEntity != null && resourceTypes != null) { + List entities = policy.getResources().get("entity").getValues(); + List entityTypesRaw = policy.getResources().get("entity-type").getValues(); + + if (entities.contains("*") && entityTypesRaw.contains("*")) { + shouldClauses.clear(); + shouldClauses.add(getMap("match_all", getMap("_name", policy.getGuid() + getPolicySuffix(policy)))); + break; + } - Map dslForPolicyResources = getDSLForResources(entities, new HashSet<>(entityTypesRaw), null, - policy.getGuid() + getPolicySuffix(policy)); - shouldClauses.add(dslForPolicyResources); + Map dslForPolicyResources = getDSLForResources(entities, new HashSet<>(entityTypesRaw), null, + policy.getGuid() + getPolicySuffix(policy)); + shouldClauses.add(dslForPolicyResources); + } } } return shouldClauses;