You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "mneethiraj (via GitHub)" <gi...@apache.org> on 2026/09/06 06:48:12 UTC

[PR] RANGER-5784: add RangerAuthorizer.filterResources() API to return authorized resources [ranger]

mneethiraj opened a new pull request, #1211:
URL: https://github.com/apache/ranger/pull/1211

   
   ## What changes were proposed in this pull request?
   
   - added `RangerAuthorizer.filterResources()` method to return subset of given resources on which the user has specified permissions.
   - added REST endpoint `/authz/v1/filterResources` for the new API
   - removed enum element `ResourceMatchScope.SELF_OR_ANY_CHILD` as this is not implemented
   
   ## How was this patch tested?
   
   - added unit tests for the API introduced
   - verified that all existing unit tests successfully complete


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5784: add RangerAuthorizer.filterResources() API to return authorized resources [ranger]

Posted by "rameeshm (via GitHub)" <gi...@apache.org>.
rameeshm commented on code in PR #1211:
URL: https://github.com/apache/ranger/pull/1211#discussion_r3954490578


##########
intg/src/main/python/apache_ranger/client/ranger_pdp_client.py:
##########
@@ -71,14 +71,27 @@ def get_resource_permissions(self, resource_perm_request):
 
         return type_coerce(resp, RangerResourcePermissions)
 
+    def filter_resources(self, filter_resources_request):
+        """
+        Call POST /authz/v1/filterResources
+        :param filter_resources_request: dict-like OR RangerFilterResourcesRequest
+        :return: RangerFilterResourcesResult
+        """
+        req  = type_coerce(filter_resources_request, RangerFilterResourcesRequest)
+        resp = self.client_http.call_api(RangerPDPClient.FILTER_RESOURCES, request_data=req)
+
+        return type_coerce(resp, RangerFilterResourcesResult)
+
     # URIs
     URI_BASE                     = "authz/v1"
     URI_AUTHORIZE                = URI_BASE + "/authorize"
     URI_AUTHORIZE_MULTI          = URI_BASE + "/authorizeMulti"
     URI_RESOURCE_PERMISSIONS     = URI_BASE + "/permissions"
+    URI_RESOURCE_PERMISSIONS     = URI_BASE + "/filterResources"

Review Comment:
   URI_RESOURCE_PERMISSIONS this has to be changed to URI_FILTER_RESOURCES?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5784: add RangerAuthorizer.filterResources() API to return authorized resources [ranger]

Posted by "mneethiraj (via GitHub)" <gi...@apache.org>.
mneethiraj merged PR #1211:
URL: https://github.com/apache/ranger/pull/1211


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5784: add RangerAuthorizer.filterResources() API to return authorized resources [ranger]

Posted by "mneethiraj (via GitHub)" <gi...@apache.org>.
mneethiraj commented on code in PR #1211:
URL: https://github.com/apache/ranger/pull/1211#discussion_r3954864840


##########
intg/src/main/python/apache_ranger/client/ranger_pdp_client.py:
##########
@@ -71,14 +71,27 @@ def get_resource_permissions(self, resource_perm_request):
 
         return type_coerce(resp, RangerResourcePermissions)
 
+    def filter_resources(self, filter_resources_request):
+        """
+        Call POST /authz/v1/filterResources
+        :param filter_resources_request: dict-like OR RangerFilterResourcesRequest
+        :return: RangerFilterResourcesResult
+        """
+        req  = type_coerce(filter_resources_request, RangerFilterResourcesRequest)
+        resp = self.client_http.call_api(RangerPDPClient.FILTER_RESOURCES, request_data=req)
+
+        return type_coerce(resp, RangerFilterResourcesResult)
+
     # URIs
     URI_BASE                     = "authz/v1"
     URI_AUTHORIZE                = URI_BASE + "/authorize"
     URI_AUTHORIZE_MULTI          = URI_BASE + "/authorizeMulti"
     URI_RESOURCE_PERMISSIONS     = URI_BASE + "/permissions"
+    URI_RESOURCE_PERMISSIONS     = URI_BASE + "/filterResources"

Review Comment:
   Good catch! Thanks @rameeshm. I fixed this issue and added unit tests to cover this. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org