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>2022-11-29 06:08:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-29 06:08:16 +0300
commitf51c6a69f9804d1dde7a0f1717a91ca97001f871 (patch)
treec54249c948799604d3fbef42c49bc69cc57c2eb9 /app/models
parent859ee9fc169e0a899af3a683ea452d06334d15b9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/concerns/has_user_type.rb5
-rw-r--r--app/models/user.rb11
2 files changed, 14 insertions, 2 deletions
diff --git a/app/models/concerns/has_user_type.rb b/app/models/concerns/has_user_type.rb
index ccb5bebcc39..b5352db5a56 100644
--- a/app/models/concerns/has_user_type.rb
+++ b/app/models/concerns/has_user_type.rb
@@ -14,10 +14,11 @@ module HasUserType
migration_bot: 7,
security_bot: 8,
automation_bot: 9,
- security_policy_bot: 10
+ security_policy_bot: 10,
+ admin_bot: 11
}.with_indifferent_access.freeze
- BOT_USER_TYPES = %w[alert_bot project_bot support_bot visual_review_bot migration_bot security_bot automation_bot security_policy_bot].freeze
+ BOT_USER_TYPES = %w[alert_bot project_bot support_bot visual_review_bot migration_bot security_bot automation_bot security_policy_bot admin_bot].freeze
NON_INTERNAL_USER_TYPES = %w[human project_bot service_user].freeze
INTERNAL_USER_TYPES = (USER_TYPES.keys - NON_INTERNAL_USER_TYPES).freeze
diff --git a/app/models/user.rb b/app/models/user.rb
index dae7ea75583..0916a89e4d2 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -906,6 +906,17 @@ class User < ApplicationRecord
end
end
+ def admin_bot
+ email_pattern = "admin-bot%s@#{Settings.gitlab.host}"
+
+ unique_internal(where(user_type: :admin_bot), 'GitLab-Admin-Bot', email_pattern) do |u|
+ u.bio = 'Admin bot used for tasks that require admin privileges'
+ u.name = 'GitLab Admin Bot'
+ u.avatar = bot_avatar(image: 'admin-bot.png')
+ u.admin = true
+ end
+ end
+
# Return true if there is only single non-internal user in the deployment,
# ghost user is ignored.
def single_user?