kaxil commented on a change in pull request #21938:
URL: https://github.com/apache/airflow/pull/21938#discussion_r818093076



##########
File path: airflow/www/views.py
##########
@@ -612,9 +612,12 @@ def add_user_permissions_to_dag(sender, template, context, 
**extra):
 
         dag.can_edit = current_app.appbuilder.sm.can_edit_dag(dag.dag_id)
         dag.can_trigger = dag.can_edit and can_create_dag_run
-        dag.can_delete = current_app.appbuilder.sm.has_access(
-            permissions.ACTION_CAN_DELETE,
-            permissions.RESOURCE_DAG,
+        dag.can_delete = (
+            current_app.appbuilder.sm.has_access(
+                permissions.ACTION_CAN_DELETE,
+                permissions.RESOURCE_DAG,
+            )
+            or current_app.appbuilder.sm.can_delete_dag(dag.dag_id)

Review comment:
       ```suggestion
           dag.can_delete = current_app.appbuilder.sm.can_delete_dag(dag.dag_id)
   ```
   
   
https://github.com/apache/airflow/blob/1739c61ad13abe9ca3388b7c5faffc6f9854fbc1/airflow/www/security.py#L328-L331
   
   
https://github.com/apache/airflow/blob/1739c61ad13abe9ca3388b7c5faffc6f9854fbc1/airflow/www/security.py#L349
   
   
https://github.com/apache/airflow/blob/1739c61ad13abe9ca3388b7c5faffc6f9854fbc1/airflow/www/security.py#L365-L368
   
   will already take care of that




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