From: Gunnar Wrobel Date: Wed, 13 May 2009 07:04:47 +0000 (+0200) Subject: Fix the DN handling. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f217b63526f6e246162321396873439de50f00df;p=horde.git Fix the DN handling. --- diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabgermanbankarrangement.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabgermanbankarrangement.php index 4cf6a4e8d..4112e4ba5 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabgermanbankarrangement.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabgermanbankarrangement.php @@ -67,6 +67,9 @@ class Horde_Kolab_Server_Object_Kolabgermanbankarrangement extends Horde_Kolab_S 'derived' => array( self::ATTRIBUTE_OWNERUID => array( 'method' => 'getParentUid', + 'args' => array( + 2, + ), ), ), 'collapsed' => array( @@ -117,22 +120,42 @@ class Horde_Kolab_Server_Object_Kolabgermanbankarrangement extends Horde_Kolab_S $uid), Horde_Kolab_Server_Exception::INVALID_INFORMATION); } + if (!isset($info[self::ATTRIBUTE_NUMBER])) { - throw new Horde_Kolab_Server_Exception(_("No account number given!"), - Horde_Kolab_Server_Exception::INVALID_INFORMATION); + $number = $this->get(self::ATTRIBUTE_NUMBER); + if (empty($number)) { + throw new Horde_Kolab_Server_Exception(_("No account number given!"), + Horde_Kolab_Server_Exception::INVALID_INFORMATION); + } + } else { + if (is_array($info[self::ATTRIBUTE_NUMBER])) { + $number = $info[self::ATTRIBUTE_NUMBER][0]; + } else { + $number = $info[self::ATTRIBUTE_NUMBER]; + } } - if (is_array($info[self::ATTRIBUTE_NUMBER])) { - $number = $info[self::ATTRIBUTE_NUMBER][0]; + if (!isset($info[self::ATTRIBUTE_BANKCODE])) { + $bankcode = $this->get(self::ATTRIBUTE_BANKCODE); + if (empty($bankcode)) { + throw new Horde_Kolab_Server_Exception(_("No bankcode given!"), + Horde_Kolab_Server_Exception::INVALID_INFORMATION); + } } else { - $number = $info[self::ATTRIBUTE_NUMBER]; + if (is_array($info[self::ATTRIBUTE_BANKCODE])) { + $bankcode = $info[self::ATTRIBUTE_BANKCODE][0]; + } else { + $bankcode = $info[self::ATTRIBUTE_BANKCODE]; + } } $base = substr($uid, 0, strpos($uid, $this->server->getBaseUid()) - 1); unset($info[self::ATTRIBUTE_OWNERUID]); - return self::ATTRIBUTE_NUMBER . '=' . $this->server->structure->quoteForUid($number) . ',' . $base; + return self::ATTRIBUTE_NUMBER . '=' . $this->server->structure->quoteForUid($number) . ',' + . self::ATTRIBUTE_BANKCODE . '=' . $this->server->structure->quoteForUid($bankcode) . ',' + . $base; } /** diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabpop3account.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabpop3account.php index dc5a765d1..aef56f1a7 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabpop3account.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabpop3account.php @@ -29,9 +29,6 @@ class Horde_Kolab_Server_Object_Kolabpop3account extends Horde_Kolab_Server_Obje { /** Define attributes specific to this object type */ - /** The common name */ - const ATTRIBUTE_CN = 'cn'; - /** Server the account resides on */ const ATTRIBUTE_SERVER = 'externalPop3AccountServer'; @@ -78,7 +75,6 @@ class Horde_Kolab_Server_Object_Kolabpop3account extends Horde_Kolab_Server_Obje */ static public $init_attributes = array( 'defined' => array( - self::ATTRIBUTE_CN, self::ATTRIBUTE_SERVER, self::ATTRIBUTE_LOGINNAME, self::ATTRIBUTE_PASSWORD, @@ -105,7 +101,7 @@ class Horde_Kolab_Server_Object_Kolabpop3account extends Horde_Kolab_Server_Obje ), ), 'required' => array( - self::ATTRIBUTE_CN, + self::ATTRIBUTE_MAIL, self::ATTRIBUTE_SERVER, self::ATTRIBUTE_LOGINNAME, self::ATTRIBUTE_PASSWORD, @@ -144,56 +140,26 @@ class Horde_Kolab_Server_Object_Kolabpop3account extends Horde_Kolab_Server_Obje $uid), Horde_Kolab_Server_Exception::INVALID_INFORMATION); } - if (!isset($info[self::ATTRIBUTE_SERVER])) { - throw new Horde_Kolab_Server_Exception(_("No server name given!"), - Horde_Kolab_Server_Exception::INVALID_INFORMATION); - } - if (!isset($info[self::ATTRIBUTE_LOGINNAME])) { - throw new Horde_Kolab_Server_Exception(_("No login name given!"), - Horde_Kolab_Server_Exception::INVALID_INFORMATION); - } - if (is_array($info[self::ATTRIBUTE_SERVER])) { - $server = $info[self::ATTRIBUTE_SERVER][0]; - } else { - $server = $info[self::ATTRIBUTE_SERVER]; - } - if (is_array($info[self::ATTRIBUTE_LOGINNAME])) { - $user = $info[self::ATTRIBUTE_LOGINNAME][0]; + if (!isset($info[self::ATTRIBUTE_MAIL])) { + $mail = $this->get(self::ATTRIBUTE_MAIL); + if (empty($mail)) { + throw new Horde_Kolab_Server_Exception(_("No mail given!"), + Horde_Kolab_Server_Exception::INVALID_INFORMATION); + } } else { - $user = $info[self::ATTRIBUTE_LOGINNAME]; + if (is_array($info[self::ATTRIBUTE_MAIL])) { + $mail = $info[self::ATTRIBUTE_MAIL][0]; + } else { + $mail = $info[self::ATTRIBUTE_MAIL]; + } } - $cn = $user . '@' . $server; - $base = substr($uid, 0, strpos($uid, $this->server->getBaseUid()) - 1); - unset($info[self::ATTRIBUTE_OWNERUID]); - - return self::ATTRIBUTE_CN . '=' . $this->server->structure->quoteForUid($cn) . ',' . $base; - } - - /** - * Saves object information. This may either create a new entry or modify an - * existing entry. - * - * Please note that fields with multiple allowed values require the callee - * to provide the full set of values for the field. Any old values that are - * not resubmitted will be considered to be deleted. - * - * @param array $info The information about the object. - * - * @return boolean|PEAR_Error True on success. - */ - public function save($info = null) - { - if (!$this->exists() && empty($info[self::ATTRIBUTE_CN]) - && !empty($info[self::ATTRIBUTE_SERVER]) - && !empty($info[self::ATTRIBUTE_LOGINNAME])) { - $info[self::ATTRIBUTE_CN] = $info[self::ATTRIBUTE_LOGINNAME] . '@' . $info[self::ATTRIBUTE_SERVER]; - } + unset($info[self::ATTRIBUTE_OWNERUID]); - return parent::save($info); + return self::ATTRIBUTE_MAIL . '=' . $this->server->structure->quoteForUid($mail) . ',' . $base; } /**