airflow/www/security.py
"""Populates resource-based permissions."""
        if not perms:
            return
        for action, resource in perms:
            self.add_view_menu(resource)
            self.add_permission_view_menu(action, resource)
    def sync_perm_for_dag(self, dag_id, access_control=None):
        """
        Sync permissions for given dag id. The dag id surely exists in our dag bag
        as only / refresh button or DagBag will call this function
        :param dag_id: the ID of the DAG whose permissions should be updated
        :type dag_id: str
        :param access_control: a dict where each key is a rolename and
            each value is a set() of permission names (e.g.,
            {'can_read'}
        :type access_control: dict
        :return:
        """
        dag_resource_name = permissions.resource_name_for_dag(dag_id)
        for dag_perm in self.DAG_PERMS:
            self.add_permission_view_menu(dag_perm, dag_resource_name)
        if access_control:
            self._sync_dag_view_permissions(dag_resource_name, access_control)
    def _sync_dag_view_permissions(self, dag_id, access_control):