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

Unassign existing groups (optionally leave them) #5

Merged
merged 2 commits into from
Jan 18, 2024

Conversation

ambrazasp
Copy link
Member

@ambrazasp ambrazasp commented Jan 2, 2024

Before this - if you call POST /users or PATCH /users/:id groups used to be removed (those which were not passed).

After this change, you can pass unassignExistingGroups: false as parameter to leave old groups in place.

Example:
Before: If you call groups: [{id: 1, role: 'USER'}] - if user existed in group with ID 2, user is removed from that group, leaving user only in group 1.

After: If you call groups: [{id: 1, role: 'USER'}], unassignExistingGroups: false - if user existed in any other group - he/she will be left in that group without removing (unassigning)

However, keep in mind, that before this change user was removed only from visible groups (for that specific user). This change only works as toggle only. This means - if user was in group 1, group 2, group 3 (updating/creating without unassignExistingGroups parameter) if "admin" that can make changes to that user only sees group 1 and group 2, user was not removed from group 3 (it's not visible for them).

✅ Tests (4) for invite and update were written to test this parameter

@ambrazasp ambrazasp merged commit f9471ca into main Jan 18, 2024
5 checks passed
@ambrazasp ambrazasp deleted the unassign-existing-groups branch January 18, 2024 14:41
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.

2 participants