2014-11-27 02:56:12 +08:00
|
|
|
require_dependency 'admin_user_list_serializer'
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2014-11-27 02:56:12 +08:00
|
|
|
class AdminUserSerializer < AdminUserListSerializer
|
|
|
|
|
|
|
|
attributes :associated_accounts,
|
2013-05-08 09:58:34 +08:00
|
|
|
:can_send_activation_email,
|
|
|
|
:can_activate,
|
2015-01-07 00:06:05 +08:00
|
|
|
:can_deactivate,
|
2014-11-27 02:56:12 +08:00
|
|
|
:ip_address,
|
|
|
|
:registration_ip_address,
|
|
|
|
:can_send_activation_email
|
2013-10-04 11:28:49 +08:00
|
|
|
|
2014-08-23 08:34:48 +08:00
|
|
|
has_one :single_sign_on_record, serializer: SingleSignOnRecordSerializer, embed: :objects
|
|
|
|
|
2013-05-08 09:58:34 +08: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-06 04:00:47 +08:00
|
|
|
def ip_address
|
|
|
|
object.ip_address.try(:to_s)
|
|
|
|
end
|
|
|
|
|
2014-04-30 02:37:56 +08:00
|
|
|
def registration_ip_address
|
|
|
|
object.registration_ip_address.try(:to_s)
|
|
|
|
end
|
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|