Project

General

Profile

Download (1.77 KB) Statistics
| Branch: | Tag: | Revision:
88b0bbce Marc Dequènes (Duck)
#--
# LdapShadows, a Medium-level LDAP Access Library and Tool.
bc2c2691 Marc Dequènes (Duck)
# Copyright (c) 2009-2010 Marc Dequènes (Duck) <Duck@DuckCorp.org>
88b0bbce Marc Dequènes (Duck)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#++


module LdapShadows
90809ae4 Marc Dequènes (Duck)
module Elements
module LdapElement
def self.included(base)
base.extend(ClassMethods)
end
88b0bbce Marc Dequènes (Duck)
90809ae4 Marc Dequènes (Duck)
module ClassMethods
# initializers
f25d0aed Marc Dequènes (Duck)
def cast
if @cast_done
raise_error _("element '%s' already initialized") % self.handle
end
@cast_done = true
end
def cast_relations
if @cast_rel_done
raise_error _("element '%s' already post-initialized") % self.handle
end
@cast_rel_done = true
end
88b0bbce Marc Dequènes (Duck)
90809ae4 Marc Dequènes (Duck)
# default empty hooks
953a2b4d Marc Dequènes (Duck)
def hook_before_create(item); end
def hook_before_modify(item); end
def hook_before_delete(item); end
def hook_after_create(item); end
def hook_after_modify(item); end
def hook_after_delete(item); end
88b0bbce Marc Dequènes (Duck)
90809ae4 Marc Dequènes (Duck)
protected

f25d0aed Marc Dequènes (Duck)
def raise_error(msg)
90809ae4 Marc Dequènes (Duck)
raise ProcessingError, msg
end
88b0bbce Marc Dequènes (Duck)
end
end
end
end
90809ae4 Marc Dequènes (Duck)
require 'ldap_shadows/elements/object'
require 'ldap_shadows/elements/aspect'