Module: CanTango::Config::Permits::Tracking

Included in:
CanTango::Config::Permits
Defined in:
lib/cantango/permits_ext/config/permits/tracking.rb

Instance Method Summary collapse

Instance Method Details

#allowed(candidate, actions, subjects, *extra_args) ⇒ Object



4
5
6
7
8
9
# File 'lib/cantango/permits_ext/config/permits/tracking.rb', line 4

def allowed candidate, actions, subjects, *extra_args
  executed_for(candidate).inject([]) do |result, permit|
    result << permit.class if permit.can? actions, subjects, *extra_args
    result
  end
end

#denied(candidate, actions, subjects, *extra_args) ⇒ Object



11
12
13
14
15
16
# File 'lib/cantango/permits_ext/config/permits/tracking.rb', line 11

def denied candidate, actions, subjects, *extra_args
  executed_for(candidate).inject([]) do |result, permit|
    result << permit.class if permit.cannot? actions, subjects, *extra_args
    result
  end
end