You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/21 13:43:06 UTC

[GitHub] [airflow] jhtimmins commented on a change in pull request #11362: Use resource permissions for Airflow view access

jhtimmins commented on a change in pull request #11362:
URL: https://github.com/apache/airflow/pull/11362#discussion_r509294146



##########
File path: airflow/www/views.py
##########
@@ -1847,10 +1964,14 @@ class GraphForm(DateTimeWithNumRunsWithDagRunsForm):
             dag_run_state=dt_nr_dr_data['dr_state'])
 
     @expose('/duration')
-    @has_dag_access(can_dag_read=True)
-    @has_access
+    @auth.has_access([
+        (permissions.ACTION_CAN_READ, permissions.RESOURCE_DAGS),
+        (permissions.ACTION_CAN_READ, permissions.RESOURCE_TASK_INSTANCE),
+        (permissions.ACTION_CAN_READ, permissions.RESOURCE_TASK),
+        (permissions.ACTION_CAN_READ, permissions.RESOURCE_WEBSITE),
+    ])
     @action_logging
-    @provide_session
+    @provide_session  # pylint: disable=too-many-locals

Review comment:
       Surprisingly, no. Pylint gets mad if this isn't applied to the decorator, rather than the function itself. Not entirely sure why.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org