mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-16 15:33:02 +01:00
- LSldap : Ajout de debug
- LSldapObject : Modification des triggers after_modify et before_modify des attributs pour les rendre multiple si nécéssaire
This commit is contained in:
parent
74afda65d5
commit
f649783f86
2 changed files with 32 additions and 14 deletions
|
@ -290,9 +290,11 @@ class LSldap {
|
|||
LSdebug('drop : <pre>'.print_r($dropAttr,true).'</pre>');
|
||||
|
||||
if ($new) {
|
||||
LSdebug('LSldap :: add()');
|
||||
$ret = $this -> cnx -> add($entry);
|
||||
}
|
||||
else {
|
||||
LSdebug('LSldap :: update()');
|
||||
$ret = $entry -> update();
|
||||
}
|
||||
|
||||
|
|
|
@ -319,15 +319,23 @@ class LSldapObject {
|
|||
// $this -> attrs[*] => before_modify
|
||||
foreach($new_data as $attr_name => $attr_val) {
|
||||
if(isset($this -> config['attrs'][$attr_name]['before_modify'])) {
|
||||
if(function_exists($this -> config['attrs'][$attr_name]['before_modify'])) {
|
||||
if(!$this -> config['attrs'][$attr_name]['before_modify']($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(309,array('func' => $this -> config['attrs'][$attr_name]['before_modify'],'attr' => $attr_name));
|
||||
return;
|
||||
}
|
||||
if (!is_array($this -> config['attrs'][$attr_name]['before_modify'])) {
|
||||
$funcs = array($this -> config['attrs'][$attr_name]['before_modify']);
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(308,array('func' => $this -> config['attrs'][$attr_name]['before_modify'],'attr' => $attr_name));
|
||||
return;
|
||||
$funcs = $this -> config['attrs'][$attr_name]['before_modify'];
|
||||
}
|
||||
foreach($funcs as $func) {
|
||||
if(function_exists($func)) {
|
||||
if(!$func($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(309,array('func' => $func,'attr' => $attr_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(308,array('func' => $func,'attr' => $attr_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -357,15 +365,23 @@ class LSldapObject {
|
|||
// $this -> attrs[*] => After Modify
|
||||
foreach($new_data as $attr_name => $attr_val) {
|
||||
if(isset($this -> config['attrs'][$attr_name]['after_modify'])) {
|
||||
if(function_exists($this -> config['attrs'][$attr_name]['after_modify'])) {
|
||||
if(!$this -> config['attrs'][$attr_name]['after_modify']($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(307,array('func' => $this -> config['after_modify'],'attr' => $attr_name));
|
||||
return;
|
||||
}
|
||||
if (!is_array($this -> config['attrs'][$attr_name]['after_modify'])) {
|
||||
$funcs = array($this -> config['attrs'][$attr_name]['after_modify']);
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(306,array('func' => $this -> config['after_modify'],'attr' => $attr_name));
|
||||
return;
|
||||
$funcs = $this -> config['attrs'][$attr_name]['after_modify'];
|
||||
}
|
||||
foreach($funcs as $func) {
|
||||
if(function_exists($func)) {
|
||||
if(!$func($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(307,array('func' => $func,'attr' => $attr_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(306,array('func' => $func,'attr' => $attr_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue