Module: MongoMapper::Plugins::Authorized::ClassMethods

Defined in:
lib/rad/mongo_mapper/acts_as/authorized.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_authorizedObject



7
8
9
10
11
12
13
14
15
# File 'lib/rad/mongo_mapper/acts_as/authorized.rb', line 7

def acts_as_authorized
  key :global_admin, Boolean, :protected => true
  key :admin_of_accounts, Array, :protected => true
  # has_many :roles_containers, :class_name => 'RolesContainer', :protected => true          
  space_key :space_roles, Array
  
  validate :validate_anonymous
  validates_exclusion_of :name, :within => Role::PRESERVED_USER_NAMES, :if => lambda{|u| u.new_record?}
end

#anonymousObject



17
18
19
# File 'lib/rad/mongo_mapper/acts_as/authorized.rb', line 17

def anonymous
  User.find_by_name 'anonymous'
end