Skip to content

Add users to default organization on creation

Doug Stull requested to merge 437891-assign-users-to-default-org into master

What does this MR do and why?

Add users to default organization on creation

  • we need to associate all users with at least one organization.
  • make the organization_user a owner if they are an instance admin. See #423200 (closed)
  • For now, we only have the default organization, so we'll use that. That logic could change in the future depending on changes to user registration logic.
  • Placement as a callback and the potential drawbacks to that approach were considered. However, due to how users are created during our different types of registration, not all go through our creation service. It is more likely they are handled by a create/save operation in the Devise::RegistrationsController
  • Fix previous database migration test.

note: full rspec suite ran in https://gitlab.com/gitlab-org/gitlab/-/pipelines/1133910490 to ensure query counts and other areas were ok with pipeline:run-all-rspec

Database analysis

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #437891 (closed)

Edited by Doug Stull

Merge request reports