module Formol module Permissions module User extend ActiveSupport::Concern PROFILES = Proc.new{ Formol::Permissions::Manager.profiles.profiles } included do #Security attr_accessible :formol_profile #Default values default_value_for :formol_profile, :registered #Validations validates :formol_profile, :presence => true, :inclusion => { :in => PROFILES, :allow_blank => true } end module InstanceMethods def formol_allowed_to?(right, obj = nil) @allower ||= Formol::Permissions::Manager.new(self) @allower.able_to?(right, obj) end end end end end