Conversation
Changed Files
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR establishes a new invariant for ShareGroup functionality: group owners are always members of their own groups. This addresses the confusing UX of seeing "0 members" after creating a group, and prevents users from being unable to add themselves to their own groups.
Changes:
- Group creation now automatically adds the owner as a member, with an initial member count of 1
- User removal validation now prevents removing the group owner and prevents removing the last member
- A data migration retroactively adds owners as members to all existing non-deleted groups
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| gateway/sds_gateway/users/views.py | Updated _create_share_group to add owner as member; updated _process_user_removal to validate owner and last-member removal attempts |
| gateway/sds_gateway/users/tests/test_group_sharing.py | Added tests for the new owner-as-member behavior and removal validation |
| gateway/sds_gateway/api_methods/migrations/0020_add_group_owner_as_member.py | Data migration to retroactively add owners as members to existing groups |
| gateway/sds_gateway/api_methods/migrations/max_migration.txt | Updated to reference the new migration |
| gateway/.envs/example/django.prod-example.env | Corrected example domain from nd.edu to mit.edu for Haystack reference |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
klpoland
approved these changes
Feb 24, 2026
Collaborator
klpoland
left a comment
There was a problem hiding this comment.
Okay, yeah, I think the changes to add an extra check for individual vs group share origination should fix the issue I described. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes sure the owner and creator of a group is added as one of its members.
It was strange seeing a group with "0 members" after creation, even if internally, it always had an owner.
It's currently not possible to add yourself to the member list, so the user is not able to "fix" this scenario themselves.nvm, it is. But I think the change is still valid.For more predictable data, this also prevents user removal from group when:
The migration retroactively adds the owner of all existing groups as one of their members.
New test requirement: individual shares (non-group ones) must survive a group-access revocation.
Currently, individual access is revoked if the group access is revoked. This, combined with the change above, could cause this scenario to fail:
Both users' existing permissions gain G in share_groups.
To make this work, there's a migration that creates a
UserSharePermission.is_individual_shareflag to keep track of how an item was shared. If this flag is present, that individual access is not revoked by revoking access to a group the user belongs to: the user must be explicitly removed instead.