summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-19 13:11:11 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-19 13:11:11 +0200
commit5790684d1f81ca9fa63a10f3fec6339ef0092627 (patch)
treea9a8b3b546c3d450a1aed9697353e7cd88c1fe76 /lib
parentb51ededc5fef05f94a632aa7651b5a1f7395bd4e (diff)
downloadgitlab-ce-5790684d1f81ca9fa63a10f3fec6339ef0092627.tar.gz
Support pushing via SSH
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/auth.rb9
-rw-r--r--lib/gitlab/lfs_token.rb4
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
index 150a4ead45d..1e0a7ec253a 100644
--- a/lib/gitlab/auth.rb
+++ b/lib/gitlab/auth.rb
@@ -130,7 +130,14 @@ module Gitlab
if actor
token_handler = Gitlab::LfsToken.new(actor)
- Result.new(actor, nil, token_handler.type, read_authentication_abilities) if Devise.secure_compare(token_handler.value, password)
+ authentication_abilities =
+ if token_handler.user?
+ full_authentication_abilities
+ else
+ read_authentication_abilities
+ end
+
+ Result.new(actor, nil, token_handler.type, authentication_abilities) if Devise.secure_compare(token_handler.value, password)
end
end
diff --git a/lib/gitlab/lfs_token.rb b/lib/gitlab/lfs_token.rb
index f492754b1c8..d089a2f9b0b 100644
--- a/lib/gitlab/lfs_token.rb
+++ b/lib/gitlab/lfs_token.rb
@@ -33,6 +33,10 @@ module Gitlab
end
end
+ def user?
+ actor.is_a?(User)
+ end
+
def type
actor.is_a?(User) ? :lfs_token : :lfs_deploy_token
end