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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d70b7a49
Commit
d70b7a49
authored
Sep 21, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
find_user users helper method no longer overrides find_user API helper method.
parent
4d88f649
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
changelogs/unreleased/37467-helper-method-from-users-endpoint-overrides-api-helper-method.yml
...ethod-from-users-endpoint-overrides-api-helper-method.yml
+5
-0
lib/api/users.rb
lib/api/users.rb
+2
-2
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+9
-0
No files found.
changelogs/unreleased/37467-helper-method-from-users-endpoint-overrides-api-helper-method.yml
0 → 100644
View file @
d70b7a49
---
title
:
find_user Users helper method no longer overrides find_user API helper method.
merge_request
:
14418
author
:
type
:
fixed
lib/api/users.rb
View file @
d70b7a49
...
...
@@ -11,7 +11,7 @@ module API
end
helpers
do
def
find_user
(
params
)
def
find_user
_by_id
(
params
)
id
=
params
[
:user_id
]
||
params
[
:id
]
User
.
find_by
(
id:
id
)
||
not_found!
(
'User'
)
end
...
...
@@ -430,7 +430,7 @@ module API
resource
:impersonation_tokens
do
helpers
do
def
finder
(
options
=
{})
user
=
find_user
(
params
)
user
=
find_user
_by_id
(
params
)
PersonalAccessTokensFinder
.
new
({
user:
user
,
impersonation:
true
}.
merge
(
options
))
end
...
...
spec/requests/api/users_spec.rb
View file @
d70b7a49
...
...
@@ -125,6 +125,15 @@ describe API::Users do
end
context
"when admin"
do
context
'when sudo is defined'
do
it
'does not return 500'
do
admin_personal_access_token
=
create
(
:personal_access_token
,
user:
admin
).
token
get
api
(
"/users?private_token=
#{
admin_personal_access_token
}
&sudo=
#{
user
.
id
}
"
,
admin
)
expect
(
response
).
to
have_http_status
(
:success
)
end
end
it
"returns an array of users"
do
get
api
(
"/users"
,
admin
)
...
...
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