mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-23 02:19:07 +01:00
LSldapObject: fix default $attrValues handling for updateObjectsInRelation/deleteOneObjectInRelation methods
This commit is contained in:
parent
305d7447ff
commit
e92bc10c8b
1 changed files with 6 additions and 0 deletions
|
@ -1563,6 +1563,8 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this -> attrs[$attr] instanceof LSattribute) {
|
if ($this -> attrs[$attr] instanceof LSattribute) {
|
||||||
|
if (!$attrValues)
|
||||||
|
$attrValues = array($attrValue);
|
||||||
$keyValues = self :: getObjectKeyValueInRelation($object, $objectType, $attrValues);
|
$keyValues = self :: getObjectKeyValueInRelation($object, $objectType, $attrValues);
|
||||||
$values = ensureIsArray($this -> attrs[$attr] -> getValue());
|
$values = ensureIsArray($this -> attrs[$attr] -> getValue());
|
||||||
if ($values) {
|
if ($values) {
|
||||||
|
@ -1650,6 +1652,8 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
LSerror :: addErrorCode('LSrelation_05','updateObjectsInRelation');
|
LSerror :: addErrorCode('LSrelation_05','updateObjectsInRelation');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!$attrValues)
|
||||||
|
$attrValues = array($attrValue);
|
||||||
$currentDns = array();
|
$currentDns = array();
|
||||||
$currentObjects = $this -> listObjectsInRelation($object, $attr, $objectType, $attrValues);
|
$currentObjects = $this -> listObjectsInRelation($object, $attr, $objectType, $attrValues);
|
||||||
if(!is_array($currentObjects))
|
if(!is_array($currentObjects))
|
||||||
|
@ -1657,7 +1661,9 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
for ($i=0; $i<count($currentObjects); $i++) {
|
for ($i=0; $i<count($currentObjects); $i++) {
|
||||||
$currentDns[] = $currentObjects[$i] -> getDn();
|
$currentDns[] = $currentObjects[$i] -> getDn();
|
||||||
}
|
}
|
||||||
|
self :: log_trace("updateObjectsInRelation($object, $attr, $objectType, $attrValue): current DNs=".varDump($currentDns));
|
||||||
$dontTouch = array_intersect($listDns, $currentDns);
|
$dontTouch = array_intersect($listDns, $currentDns);
|
||||||
|
self :: log_trace("updateObjectsInRelation($object, $attr, $objectType, $attrValue): dontTouch=".varDump($dontTouch));
|
||||||
|
|
||||||
for($i=0; $i<count($currentObjects); $i++) {
|
for($i=0; $i<count($currentObjects); $i++) {
|
||||||
if (in_array($currentObjects[$i] -> getDn(), $dontTouch)) continue;
|
if (in_array($currentObjects[$i] -> getDn(), $dontTouch)) continue;
|
||||||
|
|
Loading…
Reference in a new issue