Sha256: 7c3ae61f43c8d4f30d4addcb81c445fe9be892da89b79ce15709902e58a92423

Contents?: true

Size: 648 Bytes

Versions: 14

Compression:

Stored size: 648 Bytes

Contents

class CheckoutPolicy < ApplicationPolicy
  def index?
    true
  end

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

  def create?
    user.try(:has_role?, 'Librarian')
  end

  def update?
    if user.try(:has_role?, 'Librarian')
      true
    elsif user && (user == record.user)
      true
    end
  end

  def destroy?
    if record.checkin && record.user
      if user.try(:has_role?, 'Librarian')
        true
      elsif user && (user == record.user)
        true
      end
    end
  end

  def remove_all?
    true if user.try(:has_role?, 'User')
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
enju_circulation-0.3.11 app/policies/checkout_policy.rb
enju_circulation-0.3.10 app/policies/checkout_policy.rb
enju_circulation-0.3.9 app/policies/checkout_policy.rb
enju_circulation-0.4.0.rc.1 app/policies/checkout_policy.rb
enju_circulation-0.3.8 app/policies/checkout_policy.rb
enju_circulation-0.3.7 app/policies/checkout_policy.rb
enju_circulation-0.4.0.beta.4 app/policies/checkout_policy.rb
enju_circulation-0.4.0.beta.3 app/policies/checkout_policy.rb
enju_circulation-0.3.6 app/policies/checkout_policy.rb
enju_circulation-0.4.0.beta.2 app/policies/checkout_policy.rb
enju_circulation-0.4.0.beta.1 app/policies/checkout_policy.rb
enju_circulation-0.3.5 app/policies/checkout_policy.rb
enju_circulation-0.3.4 app/policies/checkout_policy.rb
enju_circulation-0.3.3 app/policies/checkout_policy.rb