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
Léo-Paul Géneau
gitlab-ce
Commits
4c684a8d
Commit
4c684a8d
authored
Dec 18, 2018
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check ability for user search results
parent
b4437cfa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+2
-0
spec/lib/gitlab/search_results_spec.rb
spec/lib/gitlab/search_results_spec.rb
+8
-0
No files found.
lib/gitlab/search_results.rb
View file @
4c684a8d
...
...
@@ -138,6 +138,8 @@ module Gitlab
# rubocop: enable CodeReuse/ActiveRecord
def
users
return
User
.
none
unless
Ability
.
allowed?
(
current_user
,
:read_users_list
)
UsersFinder
.
new
(
current_user
,
search:
query
).
execute
end
...
...
spec/lib/gitlab/search_results_spec.rb
View file @
4c684a8d
...
...
@@ -123,6 +123,14 @@ describe Gitlab::SearchResults do
end
describe
'#users'
do
it
'does not call the UsersFinder when the current_user is not allowed to read users list'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_return
(
false
)
expect
(
UsersFinder
).
not_to
receive
(
:new
).
with
(
user
,
search:
'foo'
).
and_call_original
results
.
objects
(
'users'
)
end
it
'calls the UsersFinder'
do
expect
(
UsersFinder
).
to
receive
(
:new
).
with
(
user
,
search:
'foo'
).
and_call_original
...
...
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