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
5880d259
Commit
5880d259
authored
Apr 12, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add OncallScheduleEntity to users in Admin helper
parent
e2f2c941
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
1 deletion
+50
-1
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+5
-1
app/serializers/admin/user_entity.rb
app/serializers/admin/user_entity.rb
+2
-0
ee/app/controllers/ee/admin/users_controller.rb
ee/app/controllers/ee/admin/users_controller.rb
+5
-0
ee/app/serializers/ee/admin/user_entity.rb
ee/app/serializers/ee/admin/user_entity.rb
+17
-0
ee/spec/serializers/ee/admin/user_entity_spec.rb
ee/spec/serializers/ee/admin/user_entity_spec.rb
+21
-0
No files found.
app/controllers/admin/users_controller.rb
View file @
5880d259
...
@@ -13,7 +13,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -13,7 +13,7 @@ class Admin::UsersController < Admin::ApplicationController
def
index
def
index
@users
=
User
.
filter_items
(
params
[
:filter
]).
order_name_asc
@users
=
User
.
filter_items
(
params
[
:filter
]).
order_name_asc
@users
=
@users
.
search_with_secondary_emails
(
params
[
:search_query
])
if
params
[
:search_query
].
present?
@users
=
@users
.
search_with_secondary_emails
(
params
[
:search_query
])
if
params
[
:search_query
].
present?
@users
=
@users
.
includes
(
:authorized_projects
)
# rubocop: disable CodeReuse/ActiveRecord
@users
=
users_with_included_associations
(
@users
)
@users
=
@users
.
sort_by_attribute
(
@sort
=
params
[
:sort
])
@users
=
@users
.
sort_by_attribute
(
@sort
=
params
[
:sort
])
@users
=
@users
.
page
(
params
[
:page
])
@users
=
@users
.
page
(
params
[
:page
])
...
@@ -228,6 +228,10 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -228,6 +228,10 @@ class Admin::UsersController < Admin::ApplicationController
protected
protected
def
users_with_included_associations
(
users
)
users
.
includes
(
:authorized_projects
)
# rubocop: disable CodeReuse/ActiveRecord
end
def
admin_making_changes_for_another_user?
def
admin_making_changes_for_another_user?
user
!=
current_user
user
!=
current_user
end
end
...
...
app/serializers/admin/user_entity.rb
View file @
5880d259
...
@@ -30,3 +30,5 @@ module Admin
...
@@ -30,3 +30,5 @@ module Admin
end
end
end
end
end
end
Admin
::
UserEntity
.
prepend_if_ee
(
'EE::Admin::UserEntity'
)
ee/app/controllers/ee/admin/users_controller.rb
View file @
5880d259
...
@@ -19,6 +19,11 @@ module EE
...
@@ -19,6 +19,11 @@ module EE
private
private
override
:users_with_included_associations
def
users_with_included_associations
(
users
)
super
.
includes
(
:oncall_schedules
)
# rubocop: disable CodeReuse/ActiveRecord
end
override
:log_impersonation_event
override
:log_impersonation_event
def
log_impersonation_event
def
log_impersonation_event
super
super
...
...
ee/app/serializers/ee/admin/user_entity.rb
0 → 100644
View file @
5880d259
# frozen_string_literal: true
module
EE
module
Admin
module
UserEntity
extend
ActiveSupport
::
Concern
prepended
do
expose
:oncall_schedules
,
with:
::
IncidentManagement
::
OncallScheduleEntity
def
oncall_schedules
object
.
oncall_schedules
.
uniq
end
end
end
end
end
ee/spec/serializers/ee/admin/user_entity_spec.rb
0 → 100644
View file @
5880d259
# frozen_string_literal: true
require
"spec_helper"
RSpec
.
describe
Admin
::
UserEntity
do
let_it_be
(
:user
)
{
build_stubbed
(
:user
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:entity
)
do
described_class
.
new
(
user
,
request:
request
)
end
describe
'#as_json'
do
subject
{
entity
.
as_json
&
.
keys
}
it
'exposes correct attributes'
do
is_expected
.
to
include
(
:oncall_schedules
)
end
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