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

Fix #866 -- Makeing sure organizaiton roles are always unique #868

Merged
merged 1 commit into from
Oct 26, 2016

Conversation

oliverroick
Copy link
Member

Proposed changes in this pull request

This PR fixes a series of issues related to duplicate OrganizationRole records. Creating duplicate OrganizationRole records was possible via the API, which resulted in exceptions being raised when accessing projects and projects list because the underlying logic expected only one organization role to be present per user and organization. The PR fixes the root cause; creating duplicate roles will not be possible any longer.

  • Add unique constraint to OrganizationRole model
  • Add integrity checks for unique constraints to serializers
  • Additional API tests

When should this PR be merged

Anytime

Risks

There is a migration that adds a unique constraint on fields user_id and organization_id on table organization_organizationrole. There is a low risk that this migration fails if there already are duplicate entries in the database. Low risk because so far it's only possible to create these duplication items via the API but not through the site.

Follow up actions

I would test this on staging against the production database before deploying to production.

- Add unique constraint to OrganizationRole model
- Add integrity checks for unique constraints to serializers
- Additional API tests
@oliverroick oliverroick force-pushed the bugfix/organzation-api-members branch from a5dd67b to 6a63afb Compare October 26, 2016 10:55
@ian-ross ian-ross merged commit 68466b8 into master Oct 26, 2016
@ian-ross ian-ross deleted the bugfix/organzation-api-members branch October 26, 2016 11:08
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