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.
airflow/api_connexion/endpoints/role_and_permission_endpoint.py
"""Get role"""
    ab_security_manager = current_app.appbuilder.sm
    role = ab_security_manager.find_role(name=role_name)
    if not role:
        raise NotFound(title="Role not found", detail=f"The Role with name `{role_name}` was not found")
    return role_schema.dump(role)
@security.requires_access([(permissions.ACTION_CAN_LIST, permissions.RESOURCE_ROLE_MODEL_VIEW)])
@format_parameters({'limit': check_limit})
def get_roles(limit, order_by='name', offset=None):
    """Get roles"""
    appbuilder = current_app.appbuilder
    session = appbuilder.get_session
    total_entries = session.query(func.count(Role.id)).scalar()
    to_replace = {"role_id": "id"}
    allowed_filter_attrs = ['role_id', 'name']
    query = session.query(Role)
    query = apply_sorting(query, order_by, to_replace, allowed_filter_attrs)
    roles = query.offset(offset).limit(limit).all()
    return role_collection_schema.dump(RoleCollection(roles=roles, total_entries=total_entries))
@security.requires_access([(permissions.ACTION_CAN_LIST, permissions.RESOURCE_PERMISSION_MODEL_VIEW)])
@format_parameters({'limit': check_limit})
def get_permissions(limit=None, offset=None):
    """Get permissions"""
    session = current_app.appbuilder.get_session
    total_entries = session.query(func.count(Permission.id)).scalar()
    query = session.query(Permission)
    actions = query.offset(offset).limit(limit).all()
    return action_collection_schema.dump(ActionCollection(actions=actions, total_entries=total_entries))