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
12 changes: 4 additions & 8 deletions airflow/www/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,10 @@ def wraps(self, *args, **kwargs):
_permission_name = self.method_permission_name.get(f.__name__)
if _permission_name:
permission_str = f"{PERMISSION_PREFIX}{_permission_name}"
if (
get_auth_manager().is_logged_in()
and permission_str in self.base_permissions
and self.appbuilder.sm.has_access(
action_name=permission_str,
resource_name=self.class_permission_name,
resource_pk=kwargs.get("pk"),
)
if permission_str in self.base_permissions and self.appbuilder.sm.has_access(
action_name=permission_str,
resource_name=self.class_permission_name,
resource_pk=kwargs.get("pk"),
):
return f(self, *args, **kwargs)
else:
Expand Down
9 changes: 4 additions & 5 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
from airflow.utils.timezone import td_format, utcnow
from airflow.version import version
from airflow.www import auth, utils as wwwutils
from airflow.www.auth import has_access_with_pk
from airflow.www.decorators import action_logging, gzipped
from airflow.www.extensions.init_auth_manager import get_auth_manager
from airflow.www.forms import (
Expand Down Expand Up @@ -3994,7 +3993,7 @@ def __getattribute__(self, attr):
return attribute

@expose("/show/<pk>", methods=["GET"])
@has_access_with_pk
@auth.has_access_with_pk
def show(self, pk):
"""
Show view.
Expand All @@ -4016,7 +4015,7 @@ def show(self, pk):
)

@expose("/edit/<pk>", methods=["GET", "POST"])
@has_access_with_pk
@auth.has_access_with_pk
def edit(self, pk):
"""
Edit view.
Expand All @@ -4040,7 +4039,7 @@ def edit(self, pk):
)

@expose("/delete/<pk>", methods=["GET", "POST"])
@has_access_with_pk
@auth.has_access_with_pk
def delete(self, pk):
"""
Delete view.
Expand Down Expand Up @@ -4738,7 +4737,7 @@ def action_muldelete(self, items):
return redirect(self.get_redirect())

@expose("/delete/<pk>", methods=["GET", "POST"])
@has_access_with_pk
@auth.has_access_with_pk
def delete(self, pk):
"""Single delete."""
if models.Pool.is_default_pool(pk):
Expand Down