You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2024/03/06 14:48:12 UTC
(airflow) 30/31: Remove useless methods from security manager (#37889)
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 876a66235d7ca45489a004b13892aae9a804411b
Author: Vincent <97...@users.noreply.github.com>
AuthorDate: Tue Mar 5 19:08:28 2024 -0500
Remove useless methods from security manager (#37889)
* Remove useless methods from security manager
* Fix mypy
(cherry picked from commit fd4dfd875d03c59dd8163f44c7c1164a3a55eb03)
---
.../fab/api_endpoints/role_and_permission_endpoint.py | 3 +--
airflow/www/security_manager.py | 17 -----------------
2 files changed, 1 insertion(+), 19 deletions(-)
diff --git a/airflow/auth/managers/fab/api_endpoints/role_and_permission_endpoint.py b/airflow/auth/managers/fab/api_endpoints/role_and_permission_endpoint.py
index ac0589385f..fba73bda11 100644
--- a/airflow/auth/managers/fab/api_endpoints/role_and_permission_endpoint.py
+++ b/airflow/auth/managers/fab/api_endpoints/role_and_permission_endpoint.py
@@ -40,10 +40,9 @@ from airflow.utils.airflow_flask_app import get_airflow_app
if TYPE_CHECKING:
from airflow.api_connexion.types import APIResponse, UpdateMask
- from airflow.www.security_manager import AirflowSecurityManagerV2
-def _check_action_and_resource(sm: AirflowSecurityManagerV2, perms: list[tuple[str, str]]) -> None:
+def _check_action_and_resource(sm: FabAirflowSecurityManagerOverride, perms: list[tuple[str, str]]) -> None:
"""
Check if the action or resource exists and otherwise raise 400.
diff --git a/airflow/www/security_manager.py b/airflow/www/security_manager.py
index 772e672ff6..ebeddf5c12 100644
--- a/airflow/www/security_manager.py
+++ b/airflow/www/security_manager.py
@@ -344,20 +344,3 @@ class AirflowSecurityManagerV2(LoggingMixin):
self._get_auth_manager_is_authorized_method(fab_resource_name=item)(action, resource_pk, user)
for item in items
)
-
- """
- The following methods are specific to FAB auth manager. They still need to be "present" in the main
- security manager class, but they do nothing.
- """
-
- def get_action(self, name: str) -> Action:
- raise NotImplementedError("Only available if FAB auth manager is used")
-
- def get_resource(self, name: str) -> Resource:
- raise NotImplementedError("Only available if FAB auth manager is used")
-
- def add_permissions_view(self, base_action_names, resource_name):
- pass
-
- def add_permissions_menu(self, resource_name):
- pass