Skip to content
Snippets Groups Projects

Add routes to allow git actions on snippet repositories

All threads resolved!
35 files
+ 801
130
Compare changes
  • Side-by-side
  • Inline
Files
35
@@ -51,7 +51,6 @@ def authenticate_user
@@ -51,7 +51,6 @@ def authenticate_user
return # Allow access
return # Allow access
end
end
elsif http_download_allowed?
elsif http_download_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
@@ -81,7 +80,7 @@ def project
@@ -81,7 +80,7 @@ def project
end
end
def parse_repo_path
def parse_repo_path
@project, @repo_type, @redirected_path = Gitlab::RepoPath.parse("#{params[:namespace_id]}/#{params[:repository_id]}")
@container, @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
@@ -93,7 +92,7 @@ def render_missing_personal_access_token
@@ -93,7 +92,7 @@ def render_missing_personal_access_token
def repository
def repository
strong_memoize(:repository) do
strong_memoize(:repository) do
repo_type.repository_for(project)
repo_type.repository_for(@container)
end
end
end
end
@@ -117,7 +116,7 @@ def ci?
@@ -117,7 +116,7 @@ def ci?
def http_download_allowed?
def http_download_allowed?
Gitlab::ProtocolAccess.allowed?('http') &&
Gitlab::ProtocolAccess.allowed?('http') &&
download_request? &&
download_request? &&
project && Guest.can?(:download_code, project)
(project && Guest.can?(:download_code, project) || @container.is_a?(PersonalSnippet))
end
end
end
end
end
end
Loading