Move permissions view to FAB Auth manager
"""Sync the provided roles and permissions."""
        existing_roles = self._get_all_roles_with_permissions()
        non_dag_perms = self._get_all_non_dag_permissions()
        for config in roles:
            role_name = config["role"]
            perms = config["perms"]
            role = existing_roles.get(role_name) or self.add_role(role_name)
            for action_name, resource_name in perms:
                perm = non_dag_perms.get((action_name, resource_name)) or self.create_permission(
                    action_name, resource_name
                )
                if perm not in role.permissions:
                    self.add_permission_to_role(role, perm)
    def delete_role(self, role_name: str) -> None:
        """
        Delete the given Role.
        :param role_name: the name of a role in the ab_role table
        """
        session = self.appbuilder.get_session
        role = session.query(Role).filter(Role.name == role_name).first()
        if role:
            self.log.info("Deleting role '%s'", role_name)
            session.delete(role)
            session.commit()
        else:
            raise AirflowException(f"Role named '{role_name}' does not exist")
    @staticmethod
    def get_user_roles(user=None):