Class: MongoidAbility::ResolveInheritedLocks

Inherits:
ResolveLocks
  • Object
show all
Defined in:
lib/mongoid_ability/resolve_inherited_locks.rb

Instance Attribute Summary

Attributes inherited from ResolveLocks

#action, #options, #owner, #subject, #subject_class, #subject_id, #subject_type

Instance Method Summary collapse

Methods inherited from ResolveLocks

call, #initialize

Constructor Details

This class inherits a constructor from MongoidAbility::ResolveLocks

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/mongoid_ability/resolve_inherited_locks.rb', line 4

def call
  uo = user_outcome
  return uo if uo != nil

  if owner.respond_to?(owner.class.inherit_from_relation_name) && owner.inherit_from_relation != nil
    io = owner.inherit_from_relation.collect { |inherited_owner| inherited_owner_outcome(inherited_owner) }.compact
    return io.any?{ |o| o == true } unless io.empty?
  end

  default_outcome
end