This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new fd4dfd875d Remove useless methods from security manager (#37889)
fd4dfd875d is described below
commit fd4dfd875d03c59dd8163f44c7c1164a3a55eb03
Author: Vincent <[email protected]>
AuthorDate: Tue Mar 5 19:08:28 2024 -0500
Remove useless methods from security manager (#37889)
* Remove useless methods from security manager
* Fix mypy
---
.../api_endpoints/role_and_permission_endpoint.py | 3 +--
airflow/www/security_manager.py | 18 ------------------
2 files changed, 1 insertion(+), 20 deletions(-)
diff --git
a/airflow/providers/fab/auth_manager/api_endpoints/role_and_permission_endpoint.py
b/airflow/providers/fab/auth_manager/api_endpoints/role_and_permission_endpoint.py
index d9169ebebd..f6d3ecff82 100644
---
a/airflow/providers/fab/auth_manager/api_endpoints/role_and_permission_endpoint.py
+++
b/airflow/providers/fab/auth_manager/api_endpoints/role_and_permission_endpoint.py
@@ -41,10 +41,9 @@ from airflow.www.extensions.init_auth_manager import
get_auth_manager
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 bd31535983..1ff54b890e 100644
--- a/airflow/www/security_manager.py
+++ b/airflow/www/security_manager.py
@@ -80,7 +80,6 @@ if TYPE_CHECKING:
from sqlalchemy.orm import Session
from airflow.auth.managers.models.base_user import BaseUser
- from airflow.providers.fab.auth_manager.models import Action, Resource
class AirflowSecurityManagerV2(LoggingMixin):
@@ -349,20 +348,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