Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions airflow/auth/managers/base_auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,6 @@ def is_authorized_configuration(
:param user: the user to perform the action on. If not provided (or None), it uses the current user
"""

@abstractmethod
def is_authorized_cluster_activity(
self,
*,
method: ResourceMethod,
user: BaseUser | None = None,
) -> bool:
"""
Return whether the user is authorized to perform a given action on the cluster activity.

:param method: the method to perform
:param user: the user to perform the action on. If not provided (or None), it uses the current user
"""

@abstractmethod
def is_authorized_connection(
self,
Expand Down
3 changes: 0 additions & 3 deletions airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ def is_authorized_configuration(
entity_id=config_section,
)

def is_authorized_cluster_activity(self, *, method: ResourceMethod, user: BaseUser | None = None) -> bool:
return self.is_logged_in()

def is_authorized_connection(
self,
*,
Expand Down
3 changes: 0 additions & 3 deletions airflow/providers/fab/auth_manager/fab_auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,6 @@ def is_authorized_configuration(
) -> bool:
return self._is_authorized(method=method, resource_type=RESOURCE_CONFIG, user=user)

def is_authorized_cluster_activity(self, *, method: ResourceMethod, user: BaseUser | None = None) -> bool:
return self._is_authorized(method=method, resource_type=RESOURCE_CLUSTER_ACTIVITY, user=user)

def is_authorized_connection(
self,
*,
Expand Down
4 changes: 0 additions & 4 deletions airflow/www/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@ def _has_access(*, is_authorized: bool, func: Callable, args, kwargs):
return redirect(get_auth_manager().get_url_login(next=request.url))


def has_access_cluster_activity(method: ResourceMethod) -> Callable[[T], T]:
return _has_access_no_details(lambda: get_auth_manager().is_authorized_cluster_activity(method=method))


def has_access_configuration(method: ResourceMethod) -> Callable[[T], T]:
return _has_access_no_details(lambda: get_auth_manager().is_authorized_configuration(method=method))

Expand Down
4 changes: 2 additions & 2 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ def datasets(self):
)

@expose("/cluster_activity")
@auth.has_access_cluster_activity("GET")
@auth.has_access_view(AccessView.CLUSTER_ACTIVITY)
def cluster_activity(self):
"""Cluster Activity view."""
state_color_mapping = State.state_color.copy()
Expand Down Expand Up @@ -3556,7 +3556,7 @@ def grid_data(self):
)

@expose("/object/historical_metrics_data")
@auth.has_access_cluster_activity("GET")
@auth.has_access_view(AccessView.CLUSTER_ACTIVITY)
def historical_metrics_data(self):
"""Return cluster activity historical metrics."""
start_date = _safe_parse_datetime(request.args.get("start_date"))
Expand Down
3 changes: 0 additions & 3 deletions tests/auth/managers/test_base_auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ def is_authorized_configuration(
) -> bool:
raise NotImplementedError()

def is_authorized_cluster_activity(self, *, method: ResourceMethod, user: BaseUser | None = None) -> bool:
raise NotImplementedError()

def is_authorized_connection(
self,
*,
Expand Down
2 changes: 0 additions & 2 deletions tests/providers/fab/auth_manager/test_fab_auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
ACTION_CAN_DELETE,
ACTION_CAN_EDIT,
ACTION_CAN_READ,
RESOURCE_CLUSTER_ACTIVITY,
RESOURCE_CONFIG,
RESOURCE_CONNECTION,
RESOURCE_DAG,
Expand All @@ -52,7 +51,6 @@

IS_AUTHORIZED_METHODS_SIMPLE = {
"is_authorized_configuration": RESOURCE_CONFIG,
"is_authorized_cluster_activity": RESOURCE_CLUSTER_ACTIVITY,
"is_authorized_connection": RESOURCE_CONNECTION,
"is_authorized_dataset": RESOURCE_DATASET,
"is_authorized_variable": RESOURCE_VARIABLE,
Expand Down
1 change: 0 additions & 1 deletion tests/www/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def test_function():
@pytest.mark.parametrize(
"decorator_name, is_authorized_method_name",
[
("has_access_cluster_activity", "is_authorized_cluster_activity"),
("has_access_configuration", "is_authorized_configuration"),
("has_access_dataset", "is_authorized_dataset"),
("has_access_view", "is_authorized_view"),
Expand Down