Module: Alchemy::Permissions::GuestUser

Included in:
Alchemy::Permissions, MemberUser
Defined in:
lib/alchemy/permissions.rb

Instance Method Summary collapse

Instance Method Details

#alchemy_guest_user_rulesObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/alchemy/permissions.rb', line 35

def alchemy_guest_user_rules
  can([:show, :download], Alchemy::Attachment) { |a| !a.restricted? }
  can :see,               Alchemy::Page,       restricted: false, visible: true
  can(:display,           Alchemy::Picture)    { |p| !p.restricted? }

  can :read, Alchemy::Content, Alchemy::Content.available.not_restricted do |c|
    c.public? && !c.restricted? && !c.trashed?
  end

  can :read, Alchemy::Element, Alchemy::Element.available.not_restricted do |e|
    e.public? && !e.restricted? && !e.trashed?
  end

  can :read, Alchemy::Page, Alchemy::Page.published.not_restricted do |p|
    p.public? && !p.restricted?
  end
end