dstandish commented on code in PR #42475:
URL: https://github.com/apache/airflow/pull/42475#discussion_r1775731966


##########
airflow/api_connexion/security.py:
##########
@@ -113,18 +113,25 @@ def requires_access_dag(
     method: ResourceMethod, access_entity: DagAccessEntity | None = None
 ) -> Callable[[T], T]:
     def _is_authorized_callback(dag_id: str):
-        def callback():
-            access = get_auth_manager().is_authorized_dag(
-                method=method,
-                access_entity=access_entity,
-                details=DagDetails(id=dag_id),
-            )
-
-            # ``access`` means here:
-            # - if a DAG id is provided (``dag_id`` not None): is the user 
authorized to access this DAG
-            # - if no DAG id is provided: is the user authorized to access all 
DAGs
-            if dag_id or access or access_entity:
-                return access
+        def callback() -> bool | DagAccessEntity:
+            if dag_id:
+                # a DAG id is provided; is the user authorized to access this 
DAG?
+                return get_auth_manager().is_authorized_dag(
+                    method=method,
+                    access_entity=access_entity,
+                    details=DagDetails(id=dag_id),
+                )
+            else:
+                # here we know no DAG id is provided.

Review Comment:
   ```suggestion
                   # here we know dag_id is *not* provided.
   ```



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