summaryrefslogtreecommitdiff
path: root/lib/api/internal.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-09-21 12:22:02 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-09-21 12:22:02 +0300
commitc2a7e7b8ac283f19ef324e93380ea1c802c6e7d0 (patch)
treef52e2189b463423b9cf0a9dbae159df36eed0da5 /lib/api/internal.rb
parent8799103037873b9009a6cbfe5fd6077202531ef1 (diff)
parent6df3dd9d5ed6c16d60f560c906dded888d845953 (diff)
downloadgitlab-ce-c2a7e7b8ac283f19ef324e93380ea1c802c6e7d0.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
Diffstat (limited to 'lib/api/internal.rb')
-rw-r--r--lib/api/internal.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 6e6efece7c4..090d04544da 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -35,6 +35,14 @@ module API
Project.find_with_namespace(project_path)
end
end
+
+ def ssh_authentication_abilities
+ [
+ :read_project,
+ :download_code,
+ :push_code
+ ]
+ end
end
post "/allowed" do
@@ -51,9 +59,9 @@ module API
access =
if wiki?
- Gitlab::GitAccessWiki.new(actor, project, protocol)
+ Gitlab::GitAccessWiki.new(actor, project, protocol, authentication_abilities: ssh_authentication_abilities)
else
- Gitlab::GitAccess.new(actor, project, protocol)
+ Gitlab::GitAccess.new(actor, project, protocol, authentication_abilities: ssh_authentication_abilities)
end
access_status = access.check(params[:action], params[:changes])
@@ -74,6 +82,19 @@ module API
response
end
+ post "/lfs_authenticate" do
+ status 200
+
+ key = Key.find(params[:key_id])
+ token_handler = Gitlab::LfsToken.new(key)
+
+ {
+ username: token_handler.actor_name,
+ lfs_token: token_handler.generate,
+ repository_http_path: project.http_url_to_repo
+ }
+ end
+
get "/merge_request_urls" do
::MergeRequests::GetUrlsService.new(project).execute(params[:changes])
end