Class: AuditsPolicy

Inherits:
CollectionPolicy show all
Defined in:
app/policies/audits_policy.rb

Instance Attribute Summary

Attributes inherited from CollectionPolicy

#user

Instance Method Summary collapse

Methods inherited from CollectionPolicy

#authorize!, #initialize

Constructor Details

This class inherits a constructor from CollectionPolicy

Instance Method Details

#base_scopeObject


4
5
6
# File 'app/policies/audits_policy.rb', line 4

def base_scope
  Audit.all
end

#create?Boolean


16
17
18
# File 'app/policies/audits_policy.rb', line 16

def create?
  user.admin?
end

#index?Boolean


20
21
22
# File 'app/policies/audits_policy.rb', line 20

def index?
  user.admin?
end

#resolveObject


8
9
10
11
12
13
14
# File 'app/policies/audits_policy.rb', line 8

def resolve
  if user.admin?
    scope.all
  else
    scope.none
  end
end