module Scrivito class PublishAbility < Struct.new(:scrivito_user, :obj_id) def as_json {restriction_messages: restriction_messages} end private def restriction_messages obj = Obj.find(obj_id) scrivito_user.restriction_messages_for(obj) end end end