Module: Alchemy::Permissions::MemberUser

Includes:
GuestUser
Included in:
Alchemy::Permissions, AuthorUser
Defined in:
lib/alchemy/permissions.rb

Overview

Member rules

Includes guest users rules

Instance Method Summary collapse

Methods included from GuestUser

#alchemy_guest_user_rules

Instance Method Details

#alchemy_member_rulesObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/alchemy/permissions.rb', line 60

def alchemy_member_rules
  alchemy_guest_user_rules

  # Resources
  can [:show, :download], Alchemy::Attachment
  can :read,              Alchemy::Content,   Alchemy::Content.available do |c|
    c.public? && !c.trashed?
  end
  can :read,              Alchemy::Element,   Alchemy::Element.available do |e|
    e.public? && !e.trashed?
  end
  can :read,              Alchemy::Page,      Alchemy::Page.published do |p|
    p.public?
  end
  can :see,               Alchemy::Page,      restricted: true, visible: true
  can :display,           Alchemy::Picture
  can [:read, :update],   Alchemy.user_class, id: @user.id
end