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
# File 'lib/alchemy/permissions.rb', line 37

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

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

  can :read, Alchemy::Page, Alchemy::Page.published.not_restricted.from_current_site do |p|
    p.public? && !p.restricted? && p.site == Alchemy::Site.current
  end
end