Sha256: e9a61402e0cbf4d47a3f079bbd60959387905f7febd341ce792fcd2cda5d9847
Contents?: true
Size: 881 Bytes
Versions: 5
Compression:
Stored size: 881 Bytes
Contents
module CanTango module Api module User module Session def self.included(base) ::CanTango.config.users.registered.each do |user| base.class_eval %{ def session_#{user} current_#{user} if respond_to? :current_#{user} guest_user end } end end # give me any logged in user or the guest user def any_user *types types = types.flatten.select_labels.map(&:to_sym) c_user = ::CanTango.config.users.registered.each do |user| meth = :"current_#{user}" send(meth) if respond_to?(meth) && (types.empty? || types.include?(user)) end.compact.first c_user || guest_user end def guest_user CanTango.config.guest.user end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems