Commit 73f4025c authored by Igor Drozdov's avatar Igor Drozdov

Merge branch 'fj-fix-bug-container-internal-api' into 'master'

Replace access to container in internal API

See merge request gitlab-org/gitlab!29569
parents f0b68d76 7612db28
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module API module API
module Helpers module Helpers
module InternalHelpers module InternalHelpers
attr_reader :redirected_path, :container attr_reader :redirected_path
delegate :wiki?, to: :repo_type delegate :wiki?, to: :repo_type
...@@ -11,15 +11,22 @@ module API ...@@ -11,15 +11,22 @@ module API
@actor ||= Support::GitAccessActor.from_params(params) @actor ||= Support::GitAccessActor.from_params(params)
end end
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def repo_type def repo_type
set_project unless defined?(@repo_type) # rubocop:disable Gitlab/ModuleWithInstanceVariables parse_repo_path unless defined?(@repo_type)
@repo_type # rubocop:disable Gitlab/ModuleWithInstanceVariables @repo_type
end end
def project def project
set_project unless defined?(@project) # rubocop:disable Gitlab/ModuleWithInstanceVariables parse_repo_path unless defined?(@project)
@project # rubocop:disable Gitlab/ModuleWithInstanceVariables @project
end
def container
parse_repo_path unless defined?(@container)
@container
end end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
def access_checker_for(actor, protocol) def access_checker_for(actor, protocol)
access_checker_klass.new(actor.key_or_user, container, protocol, access_checker_klass.new(actor.key_or_user, container, protocol,
...@@ -79,7 +86,7 @@ module API ...@@ -79,7 +86,7 @@ module API
end end
# rubocop:disable Gitlab/ModuleWithInstanceVariables # rubocop:disable Gitlab/ModuleWithInstanceVariables
def set_project def parse_repo_path
@container, @project, @repo_type, @redirected_path = @container, @project, @repo_type, @redirected_path =
if params[:gl_repository] if params[:gl_repository]
Gitlab::GlRepository.parse(params[:gl_repository]) Gitlab::GlRepository.parse(params[:gl_repository])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment