Class: Gitlab::SlashCommands::Presenters::Access

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/slash_commands/presenters/access.rb

Instance Method Summary collapse

Methods inherited from Base

#display_errors, #initialize

Methods included from Routing

add_helpers, includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::SlashCommands::Presenters::Base

Instance Method Details

#access_denied(project) ⇒ Object


7
8
9
10
11
12
13
14
15
16
# File 'lib/gitlab/slash_commands/presenters/access.rb', line 7

def access_denied(project)
  ephemeral_response(text: <<~MESSAGE)
    You are not allowed to perform the given chatops command. Most
    likely you do not have access to the GitLab project for this chatops
    integration.

    The GitLab project for this chatops integration can be found at
    #{url_for(project)}.
  MESSAGE
end

#authorizeObject


35
36
37
38
39
40
41
42
43
44
# File 'lib/gitlab/slash_commands/presenters/access.rb', line 35

def authorize
  message =
    if resource
      ":wave: Hi there! Before I do anything for you, please [connect your GitLab account](#{resource})."
    else
      ":sweat_smile: Couldn't identify you, nor can I authorize you!"
    end

  ephemeral_response(text: message)
end

#deactivatedObject


22
23
24
25
26
27
28
29
# File 'lib/gitlab/slash_commands/presenters/access.rb', line 22

def deactivated
  ephemeral_response(text: <<~MESSAGE)
    You are not allowed to perform the given chatops command since
    your account has been deactivated by your administrator.

    Please log back in from a web browser to reactivate your account at #{Gitlab.config.gitlab.url}
  MESSAGE
end

#generic_access_deniedObject


18
19
20
# File 'lib/gitlab/slash_commands/presenters/access.rb', line 18

def generic_access_denied
  ephemeral_response(text: 'You are not allowed to perform the given chatops command.')
end

#not_foundObject


31
32
33
# File 'lib/gitlab/slash_commands/presenters/access.rb', line 31

def not_found
  ephemeral_response(text: "404 not found! GitLab couldn't find what you were looking for! :boom:")
end