airflow/www/security.py
"""Sync the provided roles and permissions."""
        existing_roles = self._get_all_roles_with_permissions()
        pvs = self._get_all_non_dag_permissionviews()
        for config in roles:
            role_name = config['role']
            perms = config['perms']
            role = existing_roles.get(role_name) or self.add_role(role_name)
            for perm_name, view_name in perms:
                perm_view = pvs.get((perm_name, view_name)) or self.add_permission_view_menu(
                    perm_name, view_name
                )
                if perm_view not in role.permissions:
                    self.add_permission_role(role, perm_view)
    def add_permissions(self, role, perms):
        """Adds resource permissions to a given role."""
        for perm_name, view_name in perms:
            perm_view = self.add_permission_view_menu(perm_name, view_name)
            self.add_permission_role(role, perm_view)
    def delete_role(self, role_name):