Class: Gitlab::SlashCommands::Presenters::Access
- Inherits:
-
Base
- Object
- Base
- Gitlab::SlashCommands::Presenters::Access
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
includes_helpers, redirect_legacy_paths, url_helpers
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
|
#authorize ⇒ Object
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
|
#confirm(url) ⇒ Object
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/gitlab/slash_commands/presenters/access.rb', line 46
def confirm(url)
text = [
_("To ensure the highest security standards, we verify the source of all slash commands."),
Kernel.format(_("Please confirm the request by accessing %{url} through a web browser."),
url: "<#{url}|this link>"),
_("Upon successful validation, you're granted access to slash commands.")
].join("\n\n")
ephemeral_response(text: text)
end
|
#deactivated ⇒ Object
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. Most likely
your #{Gitlab.config.gitlab.url} account needs to be reactivated.
Please log back in from a web browser to reactivate your account at #{Gitlab.config.gitlab.url}
MESSAGE
end
|
#generic_access_denied ⇒ Object
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_found ⇒ Object
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
|