diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-22 03:10:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-22 03:10:19 +0300 |
commit | 4d90876cc6b35bc418ccb6ea2536581289b272fb (patch) | |
tree | a74ea127264fa7deaaf4f1067b94687541343e8c /app/models/organizations/organization_user.rb | |
parent | 61d7d07541aafcf49a97159a6048cf6847adbd51 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/organizations/organization_user.rb')
-rw-r--r-- | app/models/organizations/organization_user.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/organizations/organization_user.rb b/app/models/organizations/organization_user.rb index 9e06870dcc6..5916f8c950f 100644 --- a/app/models/organizations/organization_user.rb +++ b/app/models/organizations/organization_user.rb @@ -16,5 +16,16 @@ module Organizations } scope :owners, -> { where(access_level: Gitlab::Access::OWNER) } + + def self.create_default_organization_record_for(user_id, access_level) + Organizations::OrganizationUser.upsert( + { + organization_id: Organizations::Organization::DEFAULT_ORGANIZATION_ID, + user_id: user_id, + access_level: access_level + }, + unique_by: [:organization_id, :user_id] + ) + end end end |