From 8b9f30b89aa13277629a7d874d30f712575941c9 Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:22:13 +0530 Subject: [PATCH] feat: add atlas authZ in case of relationship evaluator --- .../policytransformer/CachePolicyTransformerImpl.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/auth-agents-common/src/main/java/org/apache/atlas/policytransformer/CachePolicyTransformerImpl.java b/auth-agents-common/src/main/java/org/apache/atlas/policytransformer/CachePolicyTransformerImpl.java index 87df320336..bfab5baa6c 100644 --- a/auth-agents-common/src/main/java/org/apache/atlas/policytransformer/CachePolicyTransformerImpl.java +++ b/auth-agents-common/src/main/java/org/apache/atlas/policytransformer/CachePolicyTransformerImpl.java @@ -82,6 +82,7 @@ import static org.apache.atlas.repository.util.AccessControlUtils.POLICY_CATEGORY_PURPOSE; import static org.apache.atlas.repository.util.AccessControlUtils.getIsPolicyEnabled; import static org.apache.atlas.repository.util.AccessControlUtils.getPolicyCategory; +import static org.apache.atlas.services.tag.RangerServiceTag.TAG_RESOURCE_NAME; @Component public class CachePolicyTransformerImpl { @@ -709,7 +710,14 @@ private RangerPolicy getRangerPolicy(AtlasEntityHeader atlasPolicy, String servi //policy.setId(atlasPolicy.getGuid()); policy.setName((String) atlasPolicy.getAttribute(QUALIFIED_NAME)); policy.setService((String) atlasPolicy.getAttribute(ATTR_POLICY_SERVICE_NAME)); - policy.setServiceType(serviceType); + + // Adding atlas as serviceType for tag policies, as atlas_tag doesn't have all the resource available for evaluation + if (serviceType != null && serviceType.equals(TAG_RESOURCE_NAME) && policy.getService().equals("atlas")) { + policy.setServiceType("atlas"); + } else { + policy.setServiceType(serviceType); + } + policy.setGuid(atlasPolicy.getGuid()); policy.setCreatedBy(atlasPolicy.getCreatedBy()); policy.setCreateTime(atlasPolicy.getCreateTime());