Commit 3895e547 authored by Imre Farkas's avatar Imre Farkas Committed by Yorick Peterse

CE port of Move EE specific lines in API::Users

parent 9c2d0d87
# frozen_string_literal: true
module API
module Helpers
module UsersHelpers
extend ActiveSupport::Concern
extend Grape::API::Helpers
params :optional_params_ee do
end
params :optional_index_params_ee do
end
end
end
end
...@@ -15,6 +15,8 @@ module API ...@@ -15,6 +15,8 @@ module API
authenticate_non_get! authenticate_non_get!
end end
helpers Helpers::UsersHelpers
helpers do helpers do
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def find_user_by_id(params) def find_user_by_id(params)
...@@ -52,10 +54,7 @@ module API ...@@ -52,10 +54,7 @@ module API
optional :private_profile, type: Boolean, desc: 'Flag indicating the user has a private profile' optional :private_profile, type: Boolean, desc: 'Flag indicating the user has a private profile'
all_or_none_of :extern_uid, :provider all_or_none_of :extern_uid, :provider
if Gitlab.ee? use :optional_params_ee
optional :shared_runners_minutes_limit, type: Integer, desc: 'Pipeline minutes quota for this user'
optional :extra_shared_runners_minutes_limit, type: Integer, desc: '(admin-only) Extra pipeline minutes quota for this user'
end
end end
params :sort_params do params :sort_params do
...@@ -85,10 +84,7 @@ module API ...@@ -85,10 +84,7 @@ module API
use :sort_params use :sort_params
use :pagination use :pagination
use :with_custom_attributes use :with_custom_attributes
use :optional_index_params_ee
if Gitlab.ee?
optional :skip_ldap, type: Boolean, default: false, desc: 'Skip LDAP users'
end
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
get do get do
......
...@@ -276,6 +276,18 @@ describe API::Users do ...@@ -276,6 +276,18 @@ describe API::Users do
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(400)
end end
end end
context "when authenticated and ldap is enabled" do
it "returns non-ldap user" do
create :omniauth_user, provider: "ldapserver1"
get api("/users", user), params: { skip_ldap: "true" }
expect(response).to have_gitlab_http_status(200)
expect(json_response).to be_an Array
expect(json_response.first["username"]).to eq user.username
end
end
end end
describe "GET /users/:id" do describe "GET /users/:id" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment