From b1c0ac608bc598df3aabd58f20335d32e22be0f5 Mon Sep 17 00:00:00 2001 From: Sanket-Shelar Date: Tue, 29 Aug 2023 16:50:58 +0530 Subject: [PATCH] RANGER-4343: Atlas default policy is showing 2 admin users in policy items Signed-off-by: Mehul Parikh --- .../org/apache/ranger/services/atlas/RangerServiceAtlas.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/RangerServiceAtlas.java b/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/RangerServiceAtlas.java index 626862698a..fee2179b50 100644 --- a/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/RangerServiceAtlas.java +++ b/plugin-atlas/src/main/java/org/apache/ranger/services/atlas/RangerServiceAtlas.java @@ -169,7 +169,9 @@ public List getDefaultRangerPolicies() throws Exception { // 1. add adminUser to every policyItem for (RangerPolicyItem defaultPolicyItem : defaultPolicy.getPolicyItems()) { - defaultPolicyItem.getUsers().add(adminUser); + if(!defaultPolicyItem.getUsers().contains(adminUser)) { + defaultPolicyItem.getUsers().add(adminUser); + } } // 2. add a policy-item for rangertagsync user with 'entity-read' permission in the policy for 'entity-type'