8000 fix: 空间管理员鉴权问题修复 #101 by ZC-A · Pull Request #103 · TencentBlueKing/BKFlow · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: 空间管理员鉴权问题修复 #101 #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 21, 2025
Merged
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
10 changes: 7 additions & 3 deletions bkflow/space/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ def has_permission(self, request, view):
# 在 has_object_permission 中校验
return True
candidate_space_ids = set(
[request.query_params.get("space_id"), request.data.get("space_id"), view.kwargs.get("space_id")]
space_id
for space_id in [
request.query_params.get("space_id"),
request.data.get("space_id"),
view.kwargs.get("space_id"),
]
if space_id
)
if len(candidate_space_ids) != 1:
return False
space_id = candidate_space_ids.pop()
if not space_id:
return False
space_superusers = SpaceConfig.get_config(space_id, SuperusersConfig.name)
is_space_superuser = request.user.username in space_superusers
setattr(request, "is_space_superuser", is_space_superuser)
Expand Down
Loading
0