This is an automated email from the ASF dual-hosted git repository. ephraimanierobi pushed a commit to branch v2-8-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 5803f03a24e4d9042da4cf0217af015b5bd5747d Author: Vincent <[email protected]> AuthorDate: Sat Feb 10 03:31:20 2024 -0500 Move `IMPORT_ERROR` from DAG related permissions to view related permissions (#37292) (cherry picked from commit 28f94f8891ccf0827bb6e9a1538f2ffd98a4ea08) --- airflow/api_connexion/endpoints/import_error_endpoint.py | 6 +++--- airflow/auth/managers/fab/fab_auth_manager.py | 2 +- airflow/auth/managers/models/resource_details.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/airflow/api_connexion/endpoints/import_error_endpoint.py b/airflow/api_connexion/endpoints/import_error_endpoint.py index 81459b604e..f555400526 100644 --- a/airflow/api_connexion/endpoints/import_error_endpoint.py +++ b/airflow/api_connexion/endpoints/import_error_endpoint.py @@ -28,7 +28,7 @@ from airflow.api_connexion.schemas.error_schema import ( import_error_collection_schema, import_error_schema, ) -from airflow.auth.managers.models.resource_details import DagAccessEntity +from airflow.auth.managers.models.resource_details import AccessView from airflow.models.errors import ImportError as ImportErrorModel from airflow.utils.session import NEW_SESSION, provide_session @@ -38,7 +38,7 @@ if TYPE_CHECKING: from airflow.api_connexion.types import APIResponse [email protected]_access_dag("GET", DagAccessEntity.IMPORT_ERRORS) [email protected]_access_view(AccessView.IMPORT_ERRORS) @provide_session def get_import_error(*, import_error_id: int, session: Session = NEW_SESSION) -> APIResponse: """Get an import error.""" @@ -52,7 +52,7 @@ def get_import_error(*, import_error_id: int, session: Session = NEW_SESSION) -> return import_error_schema.dump(error) [email protected]_access_dag("GET", DagAccessEntity.IMPORT_ERRORS) [email protected]_access_view(AccessView.IMPORT_ERRORS) @format_parameters({"limit": check_limit}) @provide_session def get_import_errors( diff --git a/airflow/auth/managers/fab/fab_auth_manager.py b/airflow/auth/managers/fab/fab_auth_manager.py index 0b68e571aa..2e4014af2e 100644 --- a/airflow/auth/managers/fab/fab_auth_manager.py +++ b/airflow/auth/managers/fab/fab_auth_manager.py @@ -96,7 +96,6 @@ _MAP_DAG_ACCESS_ENTITY_TO_FAB_RESOURCE_TYPE: dict[DagAccessEntity, tuple[str, .. DagAccessEntity.AUDIT_LOG: (RESOURCE_AUDIT_LOG,), DagAccessEntity.CODE: (RESOURCE_DAG_CODE,), DagAccessEntity.DEPENDENCIES: (RESOURCE_DAG_DEPENDENCIES,), - DagAccessEntity.IMPORT_ERRORS: (RESOURCE_IMPORT_ERROR,), DagAccessEntity.RUN: (RESOURCE_DAG_RUN,), DagAccessEntity.SLA_MISS: (RESOURCE_SLA_MISS,), # RESOURCE_TASK_INSTANCE has been originally misused. RESOURCE_TASK_INSTANCE referred to task definition @@ -115,6 +114,7 @@ _MAP_DAG_ACCESS_ENTITY_TO_FAB_RESOURCE_TYPE: dict[DagAccessEntity, tuple[str, .. _MAP_ACCESS_VIEW_TO_FAB_RESOURCE_TYPE = { AccessView.CLUSTER_ACTIVITY: RESOURCE_CLUSTER_ACTIVITY, AccessView.DOCS: RESOURCE_DOCS, + AccessView.IMPORT_ERRORS: RESOURCE_IMPORT_ERROR, AccessView.JOBS: RESOURCE_JOB, AccessView.PLUGINS: RESOURCE_PLUGIN, AccessView.PROVIDERS: RESOURCE_PROVIDER, diff --git a/airflow/auth/managers/models/resource_details.py b/airflow/auth/managers/models/resource_details.py index eb2f81644e..fcbee5a2ad 100644 --- a/airflow/auth/managers/models/resource_details.py +++ b/airflow/auth/managers/models/resource_details.py @@ -68,6 +68,7 @@ class AccessView(Enum): CLUSTER_ACTIVITY = "CLUSTER_ACTIVITY" DOCS = "DOCS" + IMPORT_ERRORS = "IMPORT_ERRORS" JOBS = "JOBS" PLUGINS = "PLUGINS" PROVIDERS = "PROVIDERS" @@ -81,7 +82,6 @@ class DagAccessEntity(Enum): AUDIT_LOG = "AUDIT_LOG" CODE = "CODE" DEPENDENCIES = "DEPENDENCIES" - IMPORT_ERRORS = "IMPORT_ERRORS" RUN = "RUN" SLA_MISS = "SLA_MISS" TASK = "TASK"
