Class | GuestUser |
In: |
app/models/guest_user.rb
|
Parent: | User |
Guests are a special user that represents a non-logged in user. The main reason to create an explicit instance of this type of user is so that the permissions a Guest user can have can be set via the Admin interface.
Every request that a non-logged in user makes will use this User‘s permissions to determine what they can/can‘t do.
# File app/models/guest_user.rb, line 9 9: def initialize(attributes={}) 10: super({:login => Group::GUEST_CODE, :first_name => "Anonymous", :last_name => "User"}.merge(attributes)) 11: @guest = true 12: end
# File app/models/guest_user.rb, line 14 14: def able_to?(*name) 15: group && group.permissions.count(:conditions => ["name in (?)", name.map(&:to_s)]) > 0 16: end
Guests never get access to the CMS. Overridden from user so that able_to_view? will work correctly.
# File app/models/guest_user.rb, line 20 20: def cms_access? 21: false 22: end