Commit c8624438 authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'if-10137-ee_specific_lines_users_api' into 'master'

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

See merge request gitlab-org/gitlab-ce!28710
parents 9c2d0d87 3895e547
# 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
authenticate_non_get!
end
helpers Helpers::UsersHelpers
helpers do
# rubocop: disable CodeReuse/ActiveRecord
def find_user_by_id(params)
......@@ -52,10 +54,7 @@ module API
optional :private_profile, type: Boolean, desc: 'Flag indicating the user has a private profile'
all_or_none_of :extern_uid, :provider
if Gitlab.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
use :optional_params_ee
end
params :sort_params do
......@@ -85,10 +84,7 @@ module API
use :sort_params
use :pagination
use :with_custom_attributes
if Gitlab.ee?
optional :skip_ldap, type: Boolean, default: false, desc: 'Skip LDAP users'
end
use :optional_index_params_ee
end
# rubocop: disable CodeReuse/ActiveRecord
get do
......
......@@ -276,6 +276,18 @@ describe API::Users do
expect(response).to have_gitlab_http_status(400)
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
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