require 'authorization' module People class UserSerializer < ActiveModel::Serializer embed :ids, include: true attributes :id attributes :username attributes :email attributes :created_at attributes :updated_at has_many :tokens def include_id? return ::Authorization::People::User.include_id?(current_user,object,@options) end def include_email? return ::Authorization::People::User.include_email?(current_user,object,@options) end def include_username? return ::Authorization::People::User.include_username?(current_user,object,@options) end def include_created_at? return ::Authorization::People::User.include_created_at?(current_user,object,@options) end def include_updated_at? return ::Authorization::People::User.include_updated_at?(current_user,object,@options) end def include_associations! include! :tokens if ::Authorization::People::User.include_tokens?(current_user,object,@options) end end end