Skip to content
Snippets Groups Projects
Commit 935b6ae6 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Internal API

parent 6f7ccea6
No related branches found
No related tags found
No related merge requests found
Loading
@@ -19,5 +19,6 @@ module Gitlab
Loading
@@ -19,5 +19,6 @@ module Gitlab
mount Session mount Session
mount MergeRequests mount MergeRequests
mount Notes mount Notes
mount Internal
end end
end end
module Gitlab
# Access API
class Internal < Grape::API
get "/allowed" do
user = User.find_by_username(params[:username])
project = Project.find_with_namespace(params[:project])
action = case params[:action]
when 'git-upload-pack'
then :download_code
when 'git-receive-pack'
then
if project.protected_branch?(params[:ref])
:push_code_to_protected_branches
else
:push_code
end
end
user.can?(action, project)
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment