Sha256: c5679ec34eba41c417b34fa8009051e35e884937d2767955e8bb9724e38f28c5

Contents?: true

Size: 481 Bytes

Versions: 23

Compression:

Stored size: 481 Bytes

Contents

class LibraryGroupPolicy < ApplicationPolicy
  def index?
    true if user.try(:has_role?, 'Librarian')
  end

  def show?
    true if user.try(:has_role?, 'Librarian')
  end

  def show_logo?
    true
  end

  def create?
    true if user.try(:has_role?, 'Administrator')
  end

  def update?
    true if user.try(:has_role?, 'Administrator')
  end

  def destroy?
    if user.try(:has_role?, 'Administrator')
      true if record.shelves.empty? && !record.web?
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
enju_library-0.3.11 app/policies/library_group_policy.rb
enju_library-0.3.10 app/policies/library_group_policy.rb
enju_library-0.3.9 app/policies/library_group_policy.rb
enju_library-0.3.8 app/policies/library_group_policy.rb
enju_library-0.3.8.rc.2 app/policies/library_group_policy.rb
enju_library-0.3.8.rc.1 app/policies/library_group_policy.rb
enju_library-0.4.0.rc.1 app/policies/library_group_policy.rb
enju_library-0.3.7 app/policies/library_group_policy.rb
enju_library-0.3.6 app/policies/library_group_policy.rb
enju_library-0.4.0.beta.4 app/policies/library_group_policy.rb
enju_library-0.4.0.beta.3 app/policies/library_group_policy.rb
enju_library-0.4.0.beta.2 app/policies/library_group_policy.rb
enju_library-0.4.0.beta.1 app/policies/library_group_policy.rb
enju_library-0.3.5 app/policies/library_group_policy.rb
enju_library-0.3.4 app/policies/library_group_policy.rb
enju_library-0.3.3 app/policies/library_group_policy.rb
enju_library-0.3.2 app/policies/library_group_policy.rb
enju_library-0.3.1 app/policies/library_group_policy.rb
enju_library-0.3.0 app/policies/library_group_policy.rb
enju_library-0.3.0.rc.1 app/policies/library_group_policy.rb