Project

General

Profile

« Previous | Next » 

Revision 953a2b4d

Added by Marc Dequènes over 14 years ago

  • ID 953a2b4d0942a3ca69d941dc031485db21de1106

[evol/fix] fixed creation hooks call, hooks->plugins with hooks and simplified hooks, added plugin parameters in config and updated aspect/fs

View differences:

lib/ldap_shadows/elements/object.rb
after_delete_jobs
end
protected
# cannot override create_or_update() because of alias chaining
def save
before_save_jobs
r = super
after_save_jobs
r
end
def create_or_update
def save!
before_save_jobs
r = super
after_save_jobs
r
end
protected
def before_save_jobs
check_hooks_before(:save)
check_missing_attributes
......
case action
when :save
if self.new_entry?
self.class.hook_before_create(self.class.shadow, self)
self.class.hook_before_create(self)
else
self.class.hook_before_modify(self.class.shadow, self)
self.class.hook_before_modify(self)
end
when :delete
self.class.hook_before_delete(self.class.shadow, self)
self.class.hook_before_delete(self)
end
# TODO: move this in the LdapAspect class
self.aspects.each do |aspect|
aklass = self.class.shadow.get_aspect(aspect)
next if aklass.nil?
......
case action
when :save
if self.new_entry?
aklass.hook_before_create(self.class.shadow, self)
aklass.hook_before_create(self)
else
aklass.hook_before_modify(self.class.shadow, self)
aklass.hook_before_modify(self)
end
when :delete
aklass.hook_before_delete(self.class.shadow, self)
aklass.hook_before_delete(self)
end
end
end
......
case action
when :save
if self.new_entry?
aklass.hook_after_create(self.class.shadow, self)
aklass.hook_after_create(self)
else
aklass.hook_after_modify(self.class.shadow, self)
aklass.hook_after_modify(self)
end
when :delete
aklass.hook_after_delete(self.class.shadow, self)
aklass.hook_after_delete(self)
end
end
# TODO: move this in the LdapAspect class
case action
when :save
if self.new_entry?
self.class.hook_after_create(self.class.shadow, self)
self.class.hook_after_create(self)
else
self.class.hook_after_modify(self.class.shadow, self)
self.class.hook_after_modify(self)
end
when :delete
self.class.hook_after_delete(self.class.shadow, self)
self.class.hook_after_delete(self)
end
end

Also available in: Unified diff