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
19bdc419
Commit
19bdc419
authored
Feb 03, 2021
by
Jonas Waelter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove filtering out of external users for normal users
parent
6882f4c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
app/finders/users_finder.rb
app/finders/users_finder.rb
+0
-1
spec/finders/users_finder_spec.rb
spec/finders/users_finder_spec.rb
+6
-12
No files found.
app/finders/users_finder.rb
View file @
19bdc419
...
...
@@ -97,7 +97,6 @@ class UsersFinder
# rubocop: disable CodeReuse/ActiveRecord
def
by_external
(
users
)
return
users
=
users
.
where
.
not
(
external:
true
)
unless
current_user
&
.
admin?
return
users
unless
params
[
:external
]
users
.
external
...
...
spec/finders/users_finder_spec.rb
View file @
19bdc419
...
...
@@ -12,7 +12,7 @@ RSpec.describe UsersFinder do
it
'returns all users'
do
users
=
described_class
.
new
(
user
).
execute
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
blocked_user
,
omniauth_user
,
internal_user
,
admin_user
)
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
blocked_user
,
external_user
,
omniauth_user
,
internal_user
,
admin_user
)
end
it
'filters by username'
do
...
...
@@ -48,13 +48,7 @@ RSpec.describe UsersFinder do
it
'filters by active users'
do
users
=
described_class
.
new
(
user
,
active:
true
).
execute
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
omniauth_user
,
admin_user
)
end
it
'returns no external users'
do
users
=
described_class
.
new
(
user
,
external:
true
).
execute
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
blocked_user
,
omniauth_user
,
internal_user
,
admin_user
)
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
external_user
,
omniauth_user
,
admin_user
)
end
it
'filters by created_at'
do
...
...
@@ -71,7 +65,7 @@ RSpec.describe UsersFinder do
it
'filters by non internal users'
do
users
=
described_class
.
new
(
user
,
non_internal:
true
).
execute
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
blocked_user
,
omniauth_user
,
admin_user
)
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
external_user
,
blocked_user
,
omniauth_user
,
admin_user
)
end
it
'does not filter by custom attributes'
do
...
...
@@ -80,18 +74,18 @@ RSpec.describe UsersFinder do
custom_attributes:
{
foo:
'bar'
}
).
execute
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
blocked_user
,
omniauth_user
,
internal_user
,
admin_user
)
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
blocked_user
,
external_user
,
omniauth_user
,
internal_user
,
admin_user
)
end
it
'orders returned results'
do
users
=
described_class
.
new
(
user
,
sort:
'id_asc'
).
execute
expect
(
users
).
to
eq
([
normal_user
,
admin_user
,
blocked_user
,
omniauth_user
,
internal_user
,
user
])
expect
(
users
).
to
eq
([
normal_user
,
admin_user
,
blocked_user
,
external_user
,
omniauth_user
,
internal_user
,
user
])
end
it
'does not filter by admins'
do
users
=
described_class
.
new
(
user
,
admins:
true
).
execute
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
admin_user
,
blocked_user
,
omniauth_user
,
internal_user
)
expect
(
users
).
to
contain_exactly
(
user
,
normal_user
,
external_user
,
admin_user
,
blocked_user
,
omniauth_user
,
internal_user
)
end
end
...
...
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