Project

General

Profile

« Previous | Next » 

Revision dba6a81b

Added by Marc Dequènes almost 15 years ago

  • ID dba6a81bf7e3ffa1413705d69285a5f97a6a32d9

[evol] preliminary (dirty) work on hooks

View differences:

lib/ldap_shadows/controller.rb
@mod_container = mod_container
@object_definitions = {}
@aspects = {}
# should replace @aspects properly one day
@aspects2 = {}
end
def set_global_config(global_config)
......
def set_aspect(aspect_name, aspect_def)
@aspects[aspect_name] = aspect_def
filename = File.join(Config::CFG_DIR, "hooks", "aspects", aspect_name.to_s.downcase + ".rb")
if File.exists?(filename)
klass_name = "LdapAspect" + aspect_name.to_s.capitalize
klass_content = IO.read(filename)
begin
Aspects.module_eval(<<-EOS)
class #{klass_name} < Aspect
#{klass_content}
end
EOS
rescue
STDERR.puts "Could not load Aspect plugin '#{aspect_name}'"
exit 1
end
@aspects2[aspect_name] = Aspects.const_get(klass_name)
end
end
def get_aspect(aspect_name)
@aspects[aspect_name.to_sym]
end
def get_aspect_klass(aspect_name)
@aspects2[aspect_name.to_sym]
end
def self.object_name_to_klass_name(obj_name)
"LdapObject" + obj_name.to_s.capitalize
end
......
# default location for mapped objects
module Objects
end
class Aspect
def hook_create
end
def hook_mod
end
end
module Aspects
end
end

Also available in: Unified diff