astahlman commented on a change in pull request #4642: [WIP] [AIRFLOW-2694] 
Declare permissions in DAG definition
URL: https://github.com/apache/airflow/pull/4642#discussion_r253985440
 
 

 ##########
 File path: airflow/models/__init__.py
 ##########
 @@ -4244,6 +4254,63 @@ def _test_cycle_helper(self, visit_map, task_id):
 
         visit_map[task_id] = DagBag.CYCLE_DONE
 
+    def _set_dag_permissions(self, access_control):
+        """Grant permissions on this DAG's ViewModel to the given role(s).
+
+        :param access_control: a dict where each key is a rolename and
+            each value is a set() of permission names (e.g.,
+            {'can_dag_read'}
+        :type access_control: dict
+
+        """
+        sm = cached_appbuilder().sm
 
 Review comment:
   Updated - I've moved this logic from the DAG class to the 
AirflowSecurityManager and triggered it from the CLI `sync_perm` command as 
well as the `/refresh` and `/refresh_all` endpoints. This way is much better I 
think - thanks for the feedback.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to