This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new 00fd78a9b RANGER-4439: fixed duplicate resource IDs in security zone 
service resources
00fd78a9b is described below

commit 00fd78a9b629307acfef9b40ed815ce014f9f81d
Author: Subhrat Chaudhary <such...@yahoo.com>
AuthorDate: Wed Sep 27 19:38:03 2023 -0700

    RANGER-4439: fixed duplicate resource IDs in security zone service resources
    
    Signed-off-by: Madhan Neethiraj <mad...@apache.org>
---
 .../ranger/plugin/util/RangerSecurityZoneHelper.java       | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerSecurityZoneHelper.java
 
b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerSecurityZoneHelper.java
index ffd1693a1..facc305fe 100644
--- 
a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerSecurityZoneHelper.java
+++ 
b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerSecurityZoneHelper.java
@@ -209,6 +209,13 @@ public class RangerSecurityZoneHelper {
                 zoneService.setResourcesBaseInfo(this.resourcesBaseInfo);
             }
 
+            // compute nextResourceId
+            for (RangerSecurityZoneResourceBase baseInfo : resourcesBaseInfo) {
+                if (baseInfo.getId() != null && nextResourceId <= 
baseInfo.getId()) {
+                    nextResourceId = baseInfo.getId() + 1;
+                }
+            }
+
             // make sure resourcesBaseInfo has as many entries as resources
             for (int i = resourcesBaseInfo.size(); i < resources.size(); i++) {
                 RangerSecurityZoneResourceBase baseInfo = new 
RangerSecurityZoneResourceBase();
@@ -223,13 +230,6 @@ public class RangerSecurityZoneHelper {
                 resourcesBaseInfo.remove(i);
             }
 
-            // compute nextResourceId
-            for (RangerSecurityZoneResourceBase baseInfo : resourcesBaseInfo) {
-                if (baseInfo.getId() != null && nextResourceId <= 
baseInfo.getId()) {
-                    nextResourceId = baseInfo.getId() + 1;
-                }
-            }
-
             // set missing IDs
             for (RangerSecurityZoneResourceBase baseInfo : resourcesBaseInfo) {
                 if (baseInfo.getId() == null) {

Reply via email to