[
https://issues.apache.org/jira/browse/RANGER-4031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17653887#comment-17653887
]
Madhan Neethiraj commented on RANGER-4031:
------------------------------------------
[~ramackri], [~anupamrai2303] - I agree. When policy-guid is provided, the API
shouldn't require service-name/zone-name to be present.
> [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
> 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)