Module: Alchemy::Permissions::EditorUser

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

Overview

Editor rules

Includes author rules

Instance Method Summary collapse

Methods included from AuthorUser

#alchemy_author_rules

Methods included from MemberUser

#alchemy_member_rules

Methods included from GuestUser

#alchemy_guest_user_rules

Instance Method Details

#alchemy_editor_rulesObject



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/alchemy/permissions.rb', line 124

def alchemy_editor_rules
  alchemy_author_rules

  # Navigation
  can :index, [
    :alchemy_admin_languages,
    :alchemy_admin_users
  ]

  # Resources
  can [
    :copy,
    :copy_language_tree,
    :flush,
    :order,
    :switch_language
  ], Alchemy::Page

  # Resources which may be locked via template permissions
  #
  #     # config/alchemy/page_layouts.yml
  #     - name: contact
  #       editable_by:
  #         - freelancer
  #         - admin
  #
  can([
    :create,
    :destroy
  ], Alchemy::Page) { |p| p.editable_by?(@user) }

  can(:publish, Alchemy::Page) do |page|
    page.language.public? && page.editable_by?(@user)
  end

  can :manage, Alchemy::Picture
  can :manage, Alchemy::PictureDescription
  can :manage, Alchemy::Attachment
  can :manage, Alchemy::Tag
  can :index, Alchemy::Language
  can :switch, Alchemy::Language
end