Skip to content

Commit

Permalink
fix: 空间管理员鉴权问题修复 #101 (#103)
Browse files Browse the repository at this point in the history
* fix: 空间管理员鉴权问题修复 #101

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

* fix: 空间管理员鉴权问题修复 #101
  • Loading branch information
ZC-A authored and normal-wls committed Mar 3, 2025
1 parent 92988f4 commit 4dd14bc
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit 4dd14bc

Please sign in to comment.