To be able to fully manage the permissions in the UI we will need to be able to modify the roles and the permissions they have.

It probably makes sense to have one PR that adds CUD (Read is already done) endpoints for Roles.

Permissions are not createable via anything but code, so we only need these endpoints for Roles, but not Permissions.
tests/api_connexion/endpoints/test_role_and_permission_endpoint.py
#
#
import pytest
from parameterized import parameterized
from airflow.api_connexion.exceptions import EXCEPTIONS_LINK_MAP
from airflow.security import permissions
from airflow.www.security import EXISTING_ROLES
from tests.test_utils.api_connexion_utils import assert_401, create_user, delete_user
@pytest.fixture(scope="module")
def configured_app(minimal_app_for_api):
    app = minimal_app_for_api
    create_user(
        app,  
        username="test",
        role_name="Test",
        permissions=[
            (permissions.ACTION_CAN_LIST, permissions.RESOURCE_ROLE_MODEL_VIEW),
            (permissions.ACTION_CAN_SHOW, permissions.RESOURCE_ROLE_MODEL_VIEW),
            (permissions.ACTION_CAN_LIST, permissions.RESOURCE_PERMISSION_MODEL_VIEW),
        ],
    )
    create_user(app, username="test_no_permissions", role_name="TestNoPermissions")  
    yield app
    delete_user(app, username="test")  
    delete_user(app, username="test_no_permissions")  
class TestRoleEndpoint: