Sha256: b3840d27e58e9ab98ee95e29347be8fbbdf7db07bb87a576da0eda9ebb32fcad

Contents?: true

Size: 371 Bytes

Versions: 31

Compression:

Stored size: 371 Bytes

Contents

class ShelfPolicy < ApplicationPolicy
  def index?
    true
  end

  def show?
    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.items.empty? && !record.web_shelf?
    end
  end
end

Version data entries

31 entries across 29 versions & 2 rubygems

Version Path
enju_library-0.4.0.beta.4 app/policies/shelf_policy.rb
enju_library-0.4.0.beta.3 app/policies/shelf_policy.rb
enju_library-0.4.0.beta.2 app/policies/shelf_policy.rb
enju_library-0.4.0.beta.1 app/policies/shelf_policy.rb
enju_library-0.3.5 app/policies/shelf_policy.rb
enju_library-0.3.4 app/policies/shelf_policy.rb
enju_library-0.3.3 app/policies/shelf_policy.rb
enju_library-0.3.2 app/policies/shelf_policy.rb
enju_library-0.3.1 app/policies/shelf_policy.rb
enju_library-0.3.0 app/policies/shelf_policy.rb
enju_library-0.3.0.rc.1 app/policies/shelf_policy.rb
enju_library-0.3.0.beta.2 app/policies/shelf_policy.rb
enju_library-0.2.5 app/policies/shelf_policy.rb
enju_library-0.2.4 app/policies/shelf_policy.rb
enju_library-0.2.3 app/policies/shelf_policy.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_library-0.2.2/app/policies/shelf_policy.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/bundler/gems/enju_library-d36f415e177e/app/policies/shelf_policy.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_library-0.2.1/app/policies/shelf_policy.rb
enju_library-0.2.2 app/policies/shelf_policy.rb
enju_library-0.2.1 app/policies/shelf_policy.rb