Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-22 03:10:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-22 03:10:19 +0300
commit4d90876cc6b35bc418ccb6ea2536581289b272fb (patch)
treea74ea127264fa7deaaf4f1067b94687541343e8c /app/models/organizations/organization_user.rb
parent61d7d07541aafcf49a97159a6048cf6847adbd51 (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.rb11
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