DuanWeiFan commented on code in PR #36565:
URL: https://github.com/apache/airflow/pull/36565#discussion_r1441146616


##########
airflow/www/views.py:
##########
@@ -5889,6 +5905,7 @@ def add_user_permissions_to_dag(sender, template, 
context, **extra):
     dag.can_edit = get_auth_manager().is_authorized_dag(method="PUT", 
details=DagDetails(id=dag.dag_id))
     dag.can_trigger = dag.can_edit and can_create_dag_run
     dag.can_delete = get_auth_manager().is_authorized_dag(method="DELETE", 
details=DagDetails(id=dag.dag_id))
+    dag.can_pause = get_auth_manager().is_authorized_dag(method="PATCH", 
details=DagDetails(id=dag.dag_id))

Review Comment:
   Got it that is a good point.
   
   Another idea is to make pausing dag a resource - (RESOURCE_DAG_PAUSE).
   
https://github.com/apache/airflow/pull/36565/files#diff-44cea40af4e7a124bcb60c761cf12bdb52a4607d055241d15ba8f795f51f1087L30
 
   
   Instead of relying on `method="PATCH"`, we could then do similar thing as 
`dag.can_trigger` - 
   ```
   can_pause_dag = get_auth_manager().is_authorized_dag(
           method="POST", access_entity=DagAccessEntity.PAUSE
       )
   dag.can_pause = dag.can_edit and can_pause_dag
   ```



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