diff options
-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 |