[ 
https://issues.apache.org/jira/browse/RANGER-4031?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Madhan Neethiraj resolved RANGER-4031.
--------------------------------------
    Resolution: Fixed

{noformat}
commit 645b4f3d657722bbe485b87a03a5c4ecffa39d72 (HEAD -> master, origin/master, 
origin/HEAD)
Author: Ramachandran Krishnan <[email protected]>
Date:   Thu Jan 5 15:43:32 2023 +0530

    RANGER-4031: updated REST API /api/policy/guid/{guid} to fetch policy given 
its guid, without service name

    Signed-off-by: Madhan Neethiraj <[email protected]>
{noformat}
 

 
{noformat}
commit 5a66b1c3e5210db04ea985714fb31c0137afc0a4 (HEAD -> ranger-2.4, 
origin/ranger-2.4)
Author: Ramachandran Krishnan <[email protected]>
Date:   Thu Jan 5 15:43:32 2023 +0530

    RANGER-4031: updated REST API /api/policy/guid/{guid} to fetch policy given 
its guid, without service name

    Signed-off-by: Madhan Neethiraj <[email protected]>
    (cherry picked from commit 645b4f3d657722bbe485b87a03a5c4ecffa39d72)
{noformat}

> [Ranger Admin] Not able to fetch Policy details using guid 
> /api/policy/guid/{guid} without service name
> -------------------------------------------------------------------------------------------------------
>
>                 Key: RANGER-4031
>                 URL: https://issues.apache.org/jira/browse/RANGER-4031
>             Project: Ranger
>          Issue Type: Bug
>          Components: Ranger
>            Reporter: Anupam Rai
>            Assignee: Ramachandran
>            Priority: Major
>
> Not able to fetch Policy details using guid /api/policy/guid/\{guid} without 
> service name
> Request without servicename 
> {code:java}
> curl -s -L -X GET 
> "https://q************/service/public/v2/api/policy/guid/****-2f42-4451-9edf-****";
>  -H "Content-Type: application/json" -H "Accept: application/json" -H 
> "Authorization: Basic *********DEyMw=="{code}
> Response : 404 
> Request with servicename 
> {code:java}
> curl -s -L -X GET 
> "https://****************/service/public/v2/api/policy/guid/*****-2f42-4451-9edf-****?serviceName=hive";
>  -H "Content-Type: application/json" -H "Accept: application/json" -H 
> "Authorization: Basic ***************=="{code}
> Response Proper : 200 with proper details 
> Code : 
> [https://github.com/apache/ranger/blob/master/security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java#L505]
> {code:java}
> @GET  @Path("/api/policy/guid/{guid}")        
> @Produces({ "application/json", "application/xml" })
> public RangerPolicy 
> getPolicyByGUIDAndServiceNameAndZoneName(@PathParam("guid") String guid,      
>                                                                               
>                                        @DefaultValue("") 
> @QueryParam("serviceName") String serviceName,                                
>                                                                               
>                   @DefaultValue("") @QueryParam("ZoneName") String zoneName) {
>               return 
> serviceREST.getPolicyByGUIDAndServiceNameAndZoneName(guid, serviceName, 
> zoneName);       } {code}
> As query parameters are optional it should give proper response 
> Expected : User should be able to get policy details using only guid in path 
> params 
> Thanks 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to