summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-06-20 17:07:25 +0000
committerDouwe Maan <douwe@gitlab.com>2017-06-20 17:07:25 +0000
commit026455cf3af1ca7fee0279f3bed645361dac4b1f (patch)
treefe168fef120850999f8e53fb03cbe41a7973db4b
parent4f03adf22e959c7143f835bebe1593051dc93130 (diff)
parent02ad2841d8d6260309f260e661e1f7eec7a8e0a1 (diff)
downloadgitlab-ce-026455cf3af1ca7fee0279f3bed645361dac4b1f.tar.gz
Merge branch '28517-discover-by-userid' into 'master'
Allow discover by userid - issue 28517 Closes #28517 See merge request !12314
-rw-r--r--lib/api/internal.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 9ec418edea4..479ee16a611 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -71,11 +71,16 @@ module API
end
#
- # Discover user by ssh key
+ # Discover user by ssh key or user id
#
get "/discover" do
- key = Key.find(params[:key_id])
- present key.user, with: Entities::UserSafe
+ if params[:key_id]
+ key = Key.find(params[:key_id])
+ user = key.user
+ elsif params[:user_id]
+ user = User.find_by(id: params[:user_id])
+ end
+ present user, with: Entities::UserSafe
end
get "/check" do