Sha256: 239500eb33934d5c8615e23ad826e3ab3c43a603d21f3a5d948a9e218b600480

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

class AccountPolicy < AbstractResourcePolicy

    class Scope < Scope
      def resolve
        if current_user.admin?
          scope.all
        else
          scope.where(id: current_user.account.id)
        end
      end
    end



  def new?
    current_user.admin?
  end

  def index?
    @current_user.admin? || @current_user.account_admin?
  end

  def create?
    @current_user.admin?
  end

  def show?
    @current_user.admin? or @current_user.account==@model
  end

  def edit?
    @current_user.admin? or @current_user.account==@model
  end

  def update?
    @current_user.admin? or @current_user.account==@model
  end

  def destroy?
    @current_user.admin?
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oxen_account-0.1.0 app/policies/account_policy.rb