diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-06-20 17:07:25 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-06-20 17:07:25 +0000 |
commit | 026455cf3af1ca7fee0279f3bed645361dac4b1f (patch) | |
tree | fe168fef120850999f8e53fb03cbe41a7973db4b | |
parent | 4f03adf22e959c7143f835bebe1593051dc93130 (diff) | |
parent | 02ad2841d8d6260309f260e661e1f7eec7a8e0a1 (diff) | |
download | gitlab-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.rb | 11 |
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 |