2014-11-26 13:56:12 -05:00
|
|
|
require_dependency 'admin_user_list_serializer'
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2014-11-26 13:56:12 -05:00
|
|
|
class AdminUserSerializer < AdminUserListSerializer
|
|
|
|
|
2015-09-19 08:13:28 -04:00
|
|
|
attributes :name,
|
|
|
|
:associated_accounts,
|
2013-05-07 21:58:34 -04:00
|
|
|
:can_send_activation_email,
|
|
|
|
:can_activate,
|
2015-01-06 11:06:05 -05:00
|
|
|
:can_deactivate,
|
2019-04-09 11:07:04 -04:00
|
|
|
:can_approve,
|
2014-11-26 13:56:12 -05:00
|
|
|
:ip_address,
|
2017-07-04 04:29:05 -04:00
|
|
|
:registration_ip_address
|
2013-10-03 23:28:49 -04:00
|
|
|
|
2014-08-22 20:34:48 -04:00
|
|
|
has_one :single_sign_on_record, serializer: SingleSignOnRecordSerializer, embed: :objects
|
|
|
|
|
2019-04-09 11:07:04 -04:00
|
|
|
def can_approve
|
2019-04-16 14:42:47 -04:00
|
|
|
scope.can_approve?(object)
|
2019-04-09 11:07:04 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def include_can_approve?
|
|
|
|
SiteSetting.must_approve_users
|
|
|
|
end
|
|
|
|
|
2013-05-07 21:58:34 -04:00
|
|
|
def can_send_activation_email
|
|
|
|
scope.can_send_activation_email?(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_activate
|
|
|
|
scope.can_activate?(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_deactivate
|
|
|
|
scope.can_deactivate?(object)
|
|
|
|
end
|
|
|
|
|
2013-11-05 15:00:47 -05:00
|
|
|
def ip_address
|
|
|
|
object.ip_address.try(:to_s)
|
|
|
|
end
|
|
|
|
|
2014-04-29 14:37:56 -04:00
|
|
|
def registration_ip_address
|
|
|
|
object.registration_ip_address.try(:to_s)
|
|
|
|
end
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|