2018-11-19 21:01:13 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-01-19 03:22:09 -05:00
|
|
|
module Gitlab
|
2017-05-31 01:50:53 -04:00
|
|
|
module SlashCommands
|
2017-01-19 03:22:09 -05:00
|
|
|
module Presenters
|
|
|
|
class Access < Presenters::Base
|
2019-08-26 08:23:36 -04:00
|
|
|
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
|
2017-01-19 03:22:09 -05:00
|
|
|
end
|
2017-01-10 13:43:58 -05:00
|
|
|
|
2019-11-06 04:06:23 -05:00
|
|
|
def generic_access_denied
|
|
|
|
ephemeral_response(text: 'You are not allowed to perform the given chatops command.')
|
|
|
|
end
|
|
|
|
|
2019-10-10 20:06:24 -04:00
|
|
|
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
|
|
|
|
|
2017-01-19 03:22:09 -05:00
|
|
|
def not_found
|
|
|
|
ephemeral_response(text: "404 not found! GitLab couldn't find what you were looking for! :boom:")
|
2017-01-10 13:43:58 -05:00
|
|
|
end
|
|
|
|
|
2017-01-19 03:22:09 -05:00
|
|
|
def authorize
|
|
|
|
message =
|
2019-11-29 10:06:43 -05:00
|
|
|
if resource
|
|
|
|
":wave: Hi there! Before I do anything for you, please [connect your GitLab account](#{resource})."
|
2017-01-19 03:22:09 -05:00
|
|
|
else
|
2018-06-27 16:15:08 -04:00
|
|
|
":sweat_smile: Couldn't identify you, nor can I authorize you!"
|
2017-01-19 03:22:09 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
ephemeral_response(text: message)
|
|
|
|
end
|
|
|
|
end
|
2017-01-10 13:43:58 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|