Sha256: 6d25ed05b1adbd4e8942d5fef4a0fa87e8bc71b7d2adbc7631eaea72e247735e
Contents?: true
Size: 726 Bytes
Versions: 1
Compression:
Stored size: 726 Bytes
Contents
class UserPolicy < AbstractResourcePolicy class Scope < Scope def resolve return Account.where(1==2) if current_user.nil? if current_user.admin? scope.all else scope.where(account_id: current_user.account.id) end end end def index? current_user.admin? || current_user.account_admin? end def show? current_user.admin? or current_user.account_admin? or current_user == model end def update? current_user.admin? || current_user.account_admin? end def create? current_user.admin? || current_user.account_admin? end def destroy? return false if @current_user == model current_user.admin? || current_user.account_admin? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oxen_account-0.1.1 | app/policies/user_policy.rb |