From 6f830b95017d3d1e36f8f063a8d39da4ed77fd8a Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Mon, 6 Apr 2009 11:43:46 +0200 Subject: [PATCH] Fix data modifications. --- .../Kolab_Server/lib/Horde/Kolab/Server/Test.php | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Test.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Test.php index 1e1889718..08b4448d6 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Test.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Test.php @@ -504,14 +504,15 @@ class Horde_Kolab_Server_Test extends Horde_Kolab_Server_Kolab } /** - * Add a new object + * Save an object. * - * @param string $dn The DN of the object to be added. - * @param array $data The attributes of the object to be added. + * @param string $uid The UID of the object to be added. + * @param array $data The attributes of the object to be added. + * @param boolean $exists Does the object already exist on the server? * - * @return boolean True if adding succeeded. + * @return boolean True if saving succeeded. */ - public function save($dn, $data) + public function save($uid, $data, $exists = false) { if (!$this->bound) { $result = $this->bind(); @@ -525,11 +526,20 @@ class Horde_Kolab_Server_Test extends Horde_Kolab_Server_Kolab $ldap_data[$key] = $val; } - $this->data[$dn] = array( - 'dn' => $dn, - 'data' => array_merge($ldap_data, - array('dn' => $dn)), - ); + if ($exists === false) { + $this->data[$uid] = array( + 'dn' => $uid, + 'data' => array_merge($ldap_data, + array('dn' => $uid)), + ); + } else { + $this->data[$uid] = array( + 'dn' => $uid, + 'data' => array_merge($this->data[$uid]['data'], + $ldap_data, + array('dn' => $uid)), + ); + } $this->store(); } -- 2.11.0