diff options
| author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-30 11:02:43 +0000 |
|---|---|---|
| committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-30 11:02:43 +0000 |
| commit | 1a68a0a6f55049b4ad42222b0dc667fe625a7604 (patch) | |
| tree | 541a0d45943fcfc765192252ab761235e5978ef1 /lib/api/internal.rb | |
| parent | 2efee5f6410f4e8e40e9b0339393de80f4affdde (diff) | |
| parent | 1735fdd447e9d589388f7d2ec2e21f9fb3615854 (diff) | |
| download | gitlab-ce-1a68a0a6f55049b4ad42222b0dc667fe625a7604.tar.gz | |
Merge branch 'shards' into 'master'
Implement multiple repository mount points
See merge request !4578
Diffstat (limited to 'lib/api/internal.rb')
| -rw-r--r-- | lib/api/internal.rb | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 1d361569d59..b32503e8516 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -20,6 +20,20 @@ module API @wiki ||= params[:project].end_with?('.wiki') && !Project.find_with_namespace(params[:project]) end + + def project + @project ||= begin + project_path = params[:project] + + # Check for *.wiki repositories. + # Strip out the .wiki from the pathname before finding the + # project. This applies the correct project permissions to + # the wiki repository as well. + project_path.chomp!('.wiki') if wiki? + + Project.find_with_namespace(project_path) + end + end end post "/allowed" do @@ -32,16 +46,6 @@ module API User.find_by(id: params[:user_id]) end - project_path = params[:project] - - # Check for *.wiki repositories. - # Strip out the .wiki from the pathname before finding the - # project. This applies the correct project permissions to - # the wiki repository as well. - project_path.chomp!('.wiki') if wiki? - - project = Project.find_with_namespace(project_path) - access = if wiki? Gitlab::GitAccessWiki.new(actor, project) @@ -49,7 +53,17 @@ module API Gitlab::GitAccess.new(actor, project) end - access.check(params[:action], params[:changes]) + access_status = access.check(params[:action], params[:changes]) + + response = { status: access_status.status, message: access_status.message } + + if access_status.status + # Return the repository full path so that gitlab-shell has it when + # handling ssh commands + response[:repository_path] = project.repository.path_to_repo + end + + response end # |
