vincbeck commented on code in PR #69790:
URL: https://github.com/apache/airflow/pull/69790#discussion_r3622564754


##########
airflow-core/src/airflow/api_fastapi/auth/managers/base_auth_manager.py:
##########
@@ -357,13 +359,52 @@ def is_authorized_view(
         *,
         access_view: AccessView,
         user: T,
+        team_name: str | None = None,
     ) -> bool:
         """
         Return whether the user is authorized to access a read-only state of 
the installation.
 
+        Auth managers that support multi-team isolation use ``team_name`` to 
restrict access
+        to users belonging to that team. Managers without multi-team support 
accept the
+        argument and ignore it, which authorizes the view globally.
+
         :param access_view: the specific read-only view/state the 
authorization request is about.
         :param user: the user to performing the action
-        """
+        :param team_name: team the view is scoped to, if any
+        """
+
+    @cached_property
+    def _is_authorized_view_team_aware(self) -> bool:
+        """Whether this manager's ``is_authorized_view`` override accepts 
``team_name``."""
+        params = inspect.signature(self.is_authorized_view).parameters
+        return "team_name" in params or any(p.kind is 
inspect.Parameter.VAR_KEYWORD for p in params.values())
+
+    def authorize_view(self, *, access_view: AccessView, user: T, team_name: 
str | None = None) -> bool:

Review Comment:
   Why dont we:
   - Remove the `@abstractmethod` from `is_authorized_view`
   - Move this implementation to `is_authorized_view`
   ?



-- 
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