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


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

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

  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