Sha256: 23ed5a4c03663c8391a9b8e417833ec89d85ef4f5b4f68f1f68ab731e7b16235
Contents?: true
Size: 869 Bytes
Versions: 13
Compression:
Stored size: 869 Bytes
Contents
module Netzke module Core module Masquerading # Example: # masquarade_as(:role, 2) # masquarade_as(:user, 4) # masquarade_as(:world) def masquerade_as(authority_level, authority_id = true) reset_masquerading session.merge!(:"masq_#{authority_level}" => authority_id) end def reset_masquerading session[:masq_world] = session[:masq_role] = session[:masq_user] = nil end # Who are we acting as? def authority_level if session[:masq_world] :world elsif session[:masq_role] [:role, session[:masq_role]] elsif session[:masq_user] [:user, session[:masq_user]] elsif session[:netzke_user_id] [:self, session[:netzke_user_id]] else :none # or nil ? end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems