Enchanced getLDAPmodify() to allow multiple update calls
This commit is contained in:
parent
6270967ec0
commit
e7ce1030c0
@ -1256,12 +1256,15 @@ class Template extends xmlTemplate {
|
|||||||
*
|
*
|
||||||
* @param boolean Return the attribute objects (useful for a confirmation process), or the modification array for ldap_modify()
|
* @param boolean Return the attribute objects (useful for a confirmation process), or the modification array for ldap_modify()
|
||||||
*/
|
*/
|
||||||
public function getLDAPmodify($attrsOnly=false) {
|
public function getLDAPmodify($attrsOnly=false,$index=0) {
|
||||||
static $return = array();
|
static $return = array();
|
||||||
static $returnattrs = array();
|
static $returnattrs = array();
|
||||||
|
|
||||||
if ($attrsOnly && count($returnattrs))
|
if ($attrsOnly && isset($returnattrs[$index]) && count($returnattrs[$index]))
|
||||||
return $returnattrs;
|
return $returnattrs[$index];
|
||||||
|
|
||||||
|
$returnattrs[$index] = array();
|
||||||
|
$return[$index] = array();
|
||||||
|
|
||||||
# If an objectclass is being modified, we need to remove all the orphan attributes that would result.
|
# If an objectclass is being modified, we need to remove all the orphan attributes that would result.
|
||||||
if ($this->getAttribute('objectclass')->hasBeenModified()) {
|
if ($this->getAttribute('objectclass')->hasBeenModified()) {
|
||||||
@ -1316,15 +1319,15 @@ class Template extends xmlTemplate {
|
|||||||
if ($attribute->hasBeenModified()
|
if ($attribute->hasBeenModified()
|
||||||
&& (count(array_diff($attribute->getValues(),$attribute->getOldValues())) || ! count($attribute->getValues())
|
&& (count(array_diff($attribute->getValues(),$attribute->getOldValues())) || ! count($attribute->getValues())
|
||||||
|| $attribute->isForceDelete() || (count($attribute->getValues()) != count($attribute->getOldValues()))))
|
|| $attribute->isForceDelete() || (count($attribute->getValues()) != count($attribute->getOldValues()))))
|
||||||
$returnattrs[$attribute->getName()] = $attribute;
|
$returnattrs[$index][$attribute->getName()] = $attribute;
|
||||||
|
|
||||||
if ($attrsOnly)
|
if ($attrsOnly)
|
||||||
return $returnattrs;
|
return $returnattrs[$index];
|
||||||
|
|
||||||
foreach ($returnattrs as $attribute)
|
foreach ($returnattrs[$index] as $attribute)
|
||||||
$return[$attribute->getName()] = $attribute->getValues();
|
$return[$index][$attribute->getName()] = $attribute->getValues();
|
||||||
|
|
||||||
return $return;
|
return $return[$index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user