Class: Users::Internal

Inherits:
Object
  • Object
show all
Defined in:
lib/users/internal.rb

Class Method Summary collapse

Class Method Details

.admin_botObject



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/users/internal.rb', line 84

def admin_bot
  email_pattern = "admin-bot%s@#{Settings.gitlab.host}"

  unique_internal(User.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
    u.confirmed_at = Time.zone.now
  end
end

.alert_botObject



19
20
21
22
23
24
25
26
27
# File 'lib/users/internal.rb', line 19

def alert_bot
  email_pattern = "alert%s@#{Settings.gitlab.host}"

  unique_internal(User.where(user_type: :alert_bot), 'alert-bot', email_pattern) do |u|
    u.bio = 'The GitLab alert bot'
    u.name = 'GitLab Alert Bot'
    u.avatar = bot_avatar(image: 'alert-bot.png')
  end
end

.automation_botObject



63
64
65
66
67
68
69
70
71
# File 'lib/users/internal.rb', line 63

def automation_bot
  email_pattern = "automation%s@#{Settings.gitlab.host}"

  unique_internal(User.where(user_type: :automation_bot), 'automation-bot', email_pattern) do |u|
    u.bio = 'The GitLab automation bot used for automated workflows and tasks'
    u.name = 'GitLab Automation Bot'
    u.avatar = bot_avatar(image: 'support-bot.png') # todo: add an avatar for automation-bot
  end
end

.ghostObject

Return (create if necessary) the ghost user. The ghost user owns records previously belonging to deleted users.



10
11
12
13
14
15
16
17
# File 'lib/users/internal.rb', line 10

def ghost
  email = 'ghost%[email protected]'
  unique_internal(User.where(user_type: :ghost), 'ghost', email) do |u|
    u.bio = _('This is a "Ghost User", created to hold all issues authored by users that have ' \
              'since been deleted. This user cannot be removed.')
    u.name = 'Ghost User'
  end
end

.llm_botObject



73
74
75
76
77
78
79
80
81
82
# File 'lib/users/internal.rb', line 73

def llm_bot
  email_pattern = "llm-bot%s@#{Settings.gitlab.host}"

  unique_internal(User.where(user_type: :llm_bot), 'GitLab-Llm-Bot', email_pattern) do |u|
    u.bio = 'The Gitlab LLM bot used for fetching LLM-generated content'
    u.name = 'GitLab LLM Bot'
    u.avatar = bot_avatar(image: 'support-bot.png') # todo: add an avatar for llm-bot
    u.confirmed_at = Time.zone.now
  end
end

.migration_botObject



29
30
31
32
33
34
35
36
37
# File 'lib/users/internal.rb', line 29

def migration_bot
  email_pattern = "noreply+gitlab-migration-bot%s@#{Settings.gitlab.host}"

  unique_internal(User.where(user_type: :migration_bot), 'migration-bot', email_pattern) do |u|
    u.bio = 'The GitLab migration bot'
    u.name = 'GitLab Migration Bot'
    u.confirmed_at = Time.zone.now
  end
end

.security_botObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/users/internal.rb', line 39

def security_bot
  email_pattern = "security-bot%s@#{Settings.gitlab.host}"

  unique_internal(User.where(user_type: :security_bot), 'GitLab-Security-Bot', email_pattern) do |u|
    u.bio = 'System bot that monitors detected vulnerabilities for solutions ' \
            'and creates merge requests with the fixes.'
    u.name = 'GitLab Security Bot'
    u.website_url = Gitlab::Routing.url_helpers.help_page_url('user/application_security/security_bot/index.md')
    u.avatar = bot_avatar(image: 'security-bot.png')
    u.confirmed_at = Time.zone.now
  end
end

.support_botObject



52
53
54
55
56
57
58
59
60
61
# File 'lib/users/internal.rb', line 52

def support_bot
  email_pattern = "support%s@#{Settings.gitlab.host}"

  unique_internal(User.where(user_type: :support_bot), 'support-bot', email_pattern) do |u|
    u.bio = 'The GitLab support bot used for Service Desk'
    u.name = 'GitLab Support Bot'
    u.avatar = bot_avatar(image: 'support-bot.png')
    u.confirmed_at = Time.zone.now
  end
end