Skip to content
Snippets Groups Projects

Add routes to allow git actions on snippet repositories

All threads resolved!
19 files
+ 334
67
Compare changes
  • Side-by-side
  • Inline
Files
19
@@ -16,8 +16,8 @@ class Namespaces::GitHttpClientController < Namespaces::ApplicationController
@@ -16,8 +16,8 @@ class Namespaces::GitHttpClientController < Namespaces::ApplicationController
skip_around_action :set_session_storage
skip_around_action :set_session_storage
skip_before_action :verify_authenticity_token
skip_before_action :verify_authenticity_token
before_action :authenticate_user
before_action :project
before_action :project
 
before_action :authenticate_user
private
private
@@ -48,8 +48,7 @@ def authenticate_user
@@ -48,8 +48,7 @@ def authenticate_user
send_final_spnego_response
send_final_spnego_response
return # Allow access
return # Allow access
end
end
elsif project && download_request? && http_allowed? && Guest.can?(:download_code, project)
elsif http_allowed?
@authentication_result = Gitlab::Auth::Result.new(nil, project, :none, [:download_code])
@authentication_result = Gitlab::Auth::Result.new(nil, project, :none, [:download_code])
return # Allow access
return # Allow access
@@ -79,7 +78,7 @@ def project
@@ -79,7 +78,7 @@ def project
end
end
def parse_repo_path
def parse_repo_path
@project, @repo_type, @redirected_path, @subject = Gitlab::RepoPath.parse("#{params[:namespace_id]}/#{params[:repository_id]}")
@subject, @project, @repo_type, @redirected_path = Gitlab::RepoPath.parse("#{params[:namespace_id]}/#{params[:repository_id]}")
end
end
def render_missing_personal_access_token
def render_missing_personal_access_token
@@ -113,7 +112,9 @@ def ci?
@@ -113,7 +112,9 @@ def ci?
end
end
def http_allowed?
def http_allowed?
Gitlab::ProtocolAccess.allowed?('http')
Gitlab::ProtocolAccess.allowed?('http') &&
 
download_request? &&
 
(project && Guest.can?(:download_code, project) || @subject.is_a?(PersonalSnippet))
end
end
end
end
Loading