Skip to content
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

Update Parent Group dropdown on edit group page to prevent users selecting groups they don't manage #166

Conversation

jxjj
Copy link
Contributor

@jxjj jxjj commented Apr 30, 2024

Resolves #159

Currently, Bluesheet Managers can set the parent group to any group. This can be problematic if it's set to a group the user don't have permissions to edit, or if the user chooses a group's own subgroup, creating a circular reference.

This updates the ParentGroup dropdown on the EditGroup page to show:

  • only groups that the current user can update, and
  • only groups that are not subgroups of the current group

To support this, the /api/group endpoint is updated to append canCurrentUser permissions info to each group. To avoid n+1 queries, the GroupController#index batch gets permission info rather than deferring to the GroupPolicy directly.

On dev for testing.

jxjj added 4 commits April 30, 2024 15:12
- only show groups that the current user can update so that they can't transfer to another group they can't update
- prevent selecting one's own subgroup as a parent to avoid circular references
@jxjj jxjj requested a review from cmcfadden April 30, 2024 20:41
@jxjj jxjj self-assigned this Apr 30, 2024
@jxjj jxjj merged commit f8012db into develop May 1, 2024
2 checks passed
@jxjj jxjj deleted the feature/159-Bluesheet-managers-should-only-be-able-to-move-subgroups-to-they-own-or-not-be-able-move-subgroups branch May 1, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bluesheet managers should only be able to move subgroups to they own (or not be able move subgroups?)
2 participants