Lee-W commented on code in PR #54043:
URL: https://github.com/apache/airflow/pull/54043#discussion_r2249218988


##########
providers/fab/src/airflow/providers/fab/auth_manager/fab_auth_manager.py:
##########
@@ -340,14 +342,30 @@ def is_authorized_dag(
             method=dag_method, details=details, user=user
         ):
             return False
-
+        
+        # return all(
+        #     (
+        #         self._is_authorized(method=method, 
resource_type=resource_type, user=user)
+        #         if resource_type != RESOURCE_DAG_RUN or not 
hasattr(permissions, "resource_name")
+        #         else self._is_authorized_dag_run(method=method, 
details=details, user=user)
+        #     )
+        #     for resource_type in resource_types
+        # )
+
+        # if Airflow version is less than 3.1.0 and the resource type is 
RESOURCE_HITL_DETAIL, skip.
         return all(
             (
-                self._is_authorized(method=method, 
resource_type=resource_type, user=user)
-                if resource_type != RESOURCE_DAG_RUN or not 
hasattr(permissions, "resource_name")
-                else self._is_authorized_dag_run(method=method, 
details=details, user=user)
-            )
-            for resource_type in resource_types
+                True
+                if (
+                    resource_type == RESOURCE_HITL_DETAIL
+                    and 
packaging.version.parse(packaging.version.parse(airflow_version).base_version) 
< packaging.version.parse("3.1.0")

Review Comment:
   ```suggestion
                       and AIRFLOW_V_3_1_PLUS
   ```
   
   from airflow.providers.fab.version_compat import AIRFLOW_V_3_1_PLUS
   



##########
providers/fab/src/airflow/providers/fab/auth_manager/fab_auth_manager.py:
##########
@@ -340,14 +342,30 @@ def is_authorized_dag(
             method=dag_method, details=details, user=user
         ):
             return False
-
+        
+        # return all(
+        #     (
+        #         self._is_authorized(method=method, 
resource_type=resource_type, user=user)
+        #         if resource_type != RESOURCE_DAG_RUN or not 
hasattr(permissions, "resource_name")
+        #         else self._is_authorized_dag_run(method=method, 
details=details, user=user)
+        #     )
+        #     for resource_type in resource_types
+        # )
+
+        # if Airflow version is less than 3.1.0 and the resource type is 
RESOURCE_HITL_DETAIL, skip.
         return all(
             (
-                self._is_authorized(method=method, 
resource_type=resource_type, user=user)
-                if resource_type != RESOURCE_DAG_RUN or not 
hasattr(permissions, "resource_name")
-                else self._is_authorized_dag_run(method=method, 
details=details, user=user)
-            )
-            for resource_type in resource_types
+                True
+                if (
+                    resource_type == RESOURCE_HITL_DETAIL
+                    and 
packaging.version.parse(packaging.version.parse(airflow_version).base_version) 
< packaging.version.parse("3.1.0")

Review Comment:
   Is this logic ready? Looks like we're allowing HITL for all 3.1?



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