Repository navigation
fix(access): require group admin rights to update owners (CTO-5369) - #352
shrish-browserstack wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
shrish-browserstack
left a comment
There was a problem hiding this comment.
Claude Code Review (automated) — 3 inline finding(s). Full report in the PR comment below. Verdict: Failed - see PR comment.
| } | ||
| return context | ||
|
|
||
| if not request.user.user.is_allowed_admin_actions_on_group(group): |
There was a problem hiding this comment.
[High] This check depends on member_is_owner(), which doesn't filter by membership status
GroupV2.member_is_owner() reads is_owner from membership_group.get(user=user) with no status filter, and .get() can raise MultipleObjectsReturned when a user has more than one row in the group.
Suggestion: tighten the shared helper in this PR: return self.membership_group.filter(user=user, status="Approved", is_owner=True).exists().
Reviewer: code-review
Claude Code PR ReviewPR: #352 • Head: 84ebe5a • Reviewers: code-review (built-in fallback; no in-scope reviewers installed in this repo) SummaryAdds the existing owner-or-admin check ( Review Table
Findings
Verdict: FAIL — right fix in the right place; tighten |
Change
group_helper.update_owners()now applies the sameis_allowed_admin_actions_on_group(group)check that the other group-administration helpers in this module already use, and returns the existingNON_OWNER_PERMISSION_DENIED_ERROR(which the view maps to a 400) when the requester is neither a group owner nor an admin. The check runs right after the group lookup, before the request body is read or any membership is touched.No change for owners and admins: the update path is identical.
Tests
Two new tests in
Access/tests/test_group_helper.py:Verified locally on Python 3.12 with CI's setup (
config.json.sample, access modules cloned):The full-suite run includes browserstack/enigma-access-modules#117, which fixes the unrelated SSH-module test currently failing enigma CI on
main. Until #117 merges, this PR's CI will show that same pre-existing failure.🤖 Generated with Claude Code