Class: Gitlab::GitAccessSnippet
- Extended by:
- Utils::Override
- Defined in:
- lib/gitlab/git_access_snippet.rb
Constant Summary collapse
- ERROR_MESSAGES =
{ authentication_mechanism: 'The authentication mechanism is not supported.', read_snippet: 'You are not allowed to read this snippet.', update_snippet: 'You are not allowed to update this snippet.', snippet_not_found: 'The snippet you were looking for could not be found.', no_repo: 'The snippet repository you were looking for could not be found.' }.freeze
Constants inherited from GitAccess
Gitlab::GitAccess::ALL_COMMANDS, Gitlab::GitAccess::ANY, Gitlab::GitAccess::DOWNLOAD_COMMANDS, Gitlab::GitAccess::ForbiddenError, Gitlab::GitAccess::INTERNAL_TIMEOUT, Gitlab::GitAccess::LOG_HEADER, Gitlab::GitAccess::NotFoundError, Gitlab::GitAccess::PUSH_COMMANDS, Gitlab::GitAccess::TimeoutError
Instance Attribute Summary
Attributes inherited from GitAccess
#actor, #auth_result_type, #authentication_abilities, #changes, #cmd, #container, #protocol, #push_options, #redirected_path, #repository_path
Instance Method Summary collapse
- #check(cmd, changes) ⇒ Object
- #download_ability ⇒ Object
-
#initialize(actor, snippet, protocol, **kwargs) ⇒ GitAccessSnippet
constructor
A new instance of GitAccessSnippet.
- #project ⇒ Object
- #push_ability ⇒ Object
Methods included from Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods inherited from GitAccess
#deploy_key_can_download_code?, error_message, #guest_can_download?, #logger, #protocol_allowed?, #request_from_ci_build?, #user_can_download?
Constructor Details
#initialize(actor, snippet, protocol, **kwargs) ⇒ GitAccessSnippet
Returns a new instance of GitAccessSnippet.
17 18 19 20 21 22 |
# File 'lib/gitlab/git_access_snippet.rb', line 17 def initialize(actor, snippet, protocol, **kwargs) super(actor, snippet, protocol, **kwargs) @auth_result_type = nil @authentication_abilities &= [:download_code, :push_code] end |
Instance Method Details
#check(cmd, changes) ⇒ Object
30 31 32 33 34 |
# File 'lib/gitlab/git_access_snippet.rb', line 30 def check(cmd, changes) check_snippet_accessibility! super end |
#download_ability ⇒ Object
37 38 39 |
# File 'lib/gitlab/git_access_snippet.rb', line 37 def download_ability :read_snippet end |
#project ⇒ Object
25 26 27 |
# File 'lib/gitlab/git_access_snippet.rb', line 25 def project container.project if container.is_a?(ProjectSnippet) end |
#push_ability ⇒ Object
42 43 44 |
# File 'lib/gitlab/git_access_snippet.rb', line 42 def push_ability :update_snippet end |