You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2023/05/22 15:46:45 UTC

[ranger] branch ranger-2.4 updated: RANGER-4128: updated importTags API to use the service name specified in the URL for all service-resources

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

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


The following commit(s) were added to refs/heads/ranger-2.4 by this push:
     new 91042825e RANGER-4128: updated importTags API to use the service name specified in the URL for all service-resources
91042825e is described below

commit 91042825e9f40e6499a53acae77c24f7fe080738
Author: Siddhant Sontakke <si...@privacera.com>
AuthorDate: Fri May 12 19:42:31 2023 +0530

    RANGER-4128: updated importTags API to use the service name specified in the URL for all service-resources
    
    Signed-off-by: Madhan Neethiraj <ma...@apache.org>
    (cherry picked from commit 44a82e4085f82e8b25428423a4dc881d9cbd2e94)
---
 .../src/main/java/org/apache/ranger/rest/PublicAPIsv2.java        | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java b/security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java
index 7f00e9dcb..69d2260de 100644
--- a/security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java
+++ b/security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java
@@ -32,6 +32,7 @@ import org.apache.ranger.plugin.model.RangerSecurityZoneHeaderInfo;
 import org.apache.ranger.plugin.model.RangerService;
 import org.apache.ranger.plugin.model.RangerServiceDef;
 import org.apache.ranger.plugin.model.RangerServiceHeaderInfo;
+import org.apache.ranger.plugin.model.RangerServiceResource;
 import org.apache.ranger.plugin.model.RangerServiceTags;
 import org.apache.ranger.plugin.util.GrantRevokeRoleRequest;
 import org.apache.ranger.plugin.util.ServiceTags;
@@ -648,6 +649,13 @@ public class PublicAPIsv2 {
 			logger.debug("==> PublicAPIsv2.importServiceTags()");
 		}
 
+		// overwrite serviceName with the one given in url
+		if (svcTags.getServiceResources() != null) {
+			for (RangerServiceResource svcResource : svcTags.getServiceResources()) {
+				svcResource.setServiceName(serviceName);
+			}
+		}
+
 		ServiceTags serviceTags = RangerServiceTags.toServiceTags(svcTags);
 
 		// overwrite serviceName with the one given in url