dimas-b commented on code in PR #4831:
URL: https://github.com/apache/polaris/pull/4831#discussion_r3495847650


##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisAuthorizer.java:
##########
@@ -80,4 +80,19 @@ void authorizeOrThrow(
       @NonNull PolarisAuthorizableOperation authzOp,
       @Nullable List<PolarisResolvedPathWrapper> targets,
       @Nullable List<PolarisResolvedPathWrapper> secondaries);
+
+  /**
+   * Filters a candidate list of securables to only those the principal is 
authorized to see.
+   *
+   * <p>The default implementation returns all candidates unchanged, 
preserving backward
+   * compatibility for authorizers that do not implement visibility filtering.
+   *
+   * <p>If filtering encounters an error, implementations should throw rather 
than fall back to
+   * returning unfiltered results.
+   */
+  @NonNull
+  default List<PolarisSecurable> filterByVisibility(
+      @NonNull AuthorizationState authzState, @NonNull VisibilityFilterRequest 
request) {

Review Comment:
   This conceptually overlaps with the new `authorize()` method (line 53). 
   
   Once can call this method and deduce the authorization decision for the 
entity from the fact that is it excluding (or included) in the output of this 
method. At the same time, this should always be aligned with passing the data 
"operation" and "securable" through the `authorize()` method, right?
   
   Would it be possible to have one main authorization method that would return 
an `AuthorizationDecision` for each element given a list of inputs. It would be 
called directly for filtering use cases. Simpler operations would call via via 
convenience utility methods to simplify default with singular parameters.
   
   WDYT?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to