Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
3895e547
Commit
3895e547
authored
May 28, 2019
by
Imre Farkas
Committed by
Yorick Peterse
May 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CE port of Move EE specific lines in API::Users
parent
9c2d0d87
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
8 deletions
+32
-8
lib/api/helpers/users_helpers.rb
lib/api/helpers/users_helpers.rb
+16
-0
lib/api/users.rb
lib/api/users.rb
+4
-8
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+12
-0
No files found.
lib/api/helpers/users_helpers.rb
0 → 100644
View file @
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
lib/api/users.rb
View file @
3895e547
...
...
@@ -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
...
...
spec/requests/api/users_spec.rb
View file @
3895e547
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment