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

Organization and facility members are not unique #492

Closed
pitpalme opened this issue Mar 22, 2022 · 0 comments · Fixed by #524
Closed

Organization and facility members are not unique #492

pitpalme opened this issue Mar 22, 2022 · 0 comments · Fixed by #524
Assignees

Comments

@pitpalme
Copy link
Contributor

Describe the bug
Organization and facility member have no (composite) unique constraint.

To Reproduce
Add user as organization or facility member (role and state doesn't matter).
Inspect list of members.

Expected behavior
I should not be able to add a user more than once to an organization or facility.
I'd even say, role and state should not be part of "unique" definition, because IMHO
it's no real world use case to add someone at the same time as "manager" and "member",
or "approved" and "blocked".

Additional context
Doesn't harm (yet), although "blocking" someone manually this way seems not to override
any previous definition, so access might still be possible.

@christophmeissner christophmeissner self-assigned this Mar 22, 2022
christophmeissner added a commit to christophmeissner/volunteer_planner that referenced this issue Mar 27, 2022
It comes with a rather lengthy data migration for FacilityMembership and OrganizationMembership:

Duplicate memberships are squashed, keeping only the membership per user and facility/org with the highest (max) status, and if equal, with the highest (min) role.

If the user is no longer an manager or admin of any facility or organization, their `is_staff` flag will be set to `False`. They will no longer be able to use the admin interface (unless manually granted by another admin again).

fixes coders4help#492
christophmeissner added a commit to christophmeissner/volunteer_planner that referenced this issue Mar 28, 2022
It comes with a rather lengthy data migration for FacilityMembership and OrganizationMembership:

Duplicate memberships are squashed, keeping only the membership per user and facility/org with the highest (max) status, and if equal, with the highest (min) role.

If the user is no longer an manager or admin of any facility or organization, their `is_staff` flag will be set to `False`. They will no longer be able to use the admin interface (unless manually granted by another admin again).

fixes coders4help#492
christophmeissner added a commit to christophmeissner/volunteer_planner that referenced this issue Mar 28, 2022
It comes with a rather lengthy data migration for FacilityMembership and OrganizationMembership:

Duplicate memberships are squashed, keeping only the membership per user and facility/org with the highest (max) status, and if equal, with the highest (min) role.

If the user is no longer an manager or admin of any facility or organization, their `is_staff` flag will be set to `False`. They will no longer be able to use the admin interface (unless manually granted by another admin again).

fixes coders4help#492
christophmeissner added a commit to christophmeissner/volunteer_planner that referenced this issue Mar 29, 2022
It comes with a rather lengthy data migration for FacilityMembership and OrganizationMembership:

Duplicate memberships are squashed, keeping only the membership per user and facility/org with the highest (max) status, and if equal, with the highest (min) role.

If the user is no longer an manager or admin of any facility or organization, their `is_staff` flag will be set to `False`. They will no longer be able to use the admin interface (unless manually granted by another admin again).

fixes coders4help#492
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants