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.

Methods

Public Class methods

[Source]

    # 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

Public Instance methods

[Source]

    # 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

[Source]

    # File app/models/guest_user.rb, line 30
30:   def able_to_edit?(section)
31:     false
32:   end

Guests never get access to the CMS. Overridden from user so that able_to_view? will work correctly.

[Source]

    # File app/models/guest_user.rb, line 20
20:   def cms_access?
21:     false
22:   end

[Source]

    # File app/models/guest_user.rb, line 34
34:   def group
35:     @group ||= Group.guest
36:   end

[Source]

    # File app/models/guest_user.rb, line 38
38:   def groups
39:     [group]
40:   end

[Source]

    # File app/models/guest_user.rb, line 49
49:   def save(perform_validation=true)
50:     false
51:   end

You shouldn‘t be able to save a guest user

[Source]

    # File app/models/guest_user.rb, line 43
43:   def update_attribute(name, value)
44:     false
45:   end

[Source]

    # File app/models/guest_user.rb, line 46
46:   def update_attributes(attrs={})
47:     false
48:   end

Return a list of the sections associated with this user that can be viewed. Overridden from user so that able_to_view? will work correctly.

[Source]

    # File app/models/guest_user.rb, line 26
26:   def viewable_sections
27:     group.sections
28:   end

[Validate]