From: hickert Date: Mon, 16 Feb 2009 07:29:44 +0000 (+0000) Subject: Updated Mail Method kolab X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1241965beda0f7ef761735b01e40342e2a30e96e;p=gosa.git Updated Mail Method kolab -KolabDeleteflag must be fed with all kolabHost entries git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13421 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab.inc b/gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab.inc index 59f34ef1a..79c91221c 100644 --- a/gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab.inc +++ b/gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab.inc @@ -36,6 +36,11 @@ class mailMethodKolab extends mailMethodCyrus protected $userObjectClasses = array("kolabInetOrgPerson"); protected $shareObjectClasses = array("kolabSharedFolder"); + /* Handle account removal like a master/slave kolab setup. + * The kolabDeleteflag will be added for each server. + */ + protected $masterSlave = TRUE; + protected $acl_map = array( "lrsw" => "read", "lrswp" => "post", @@ -44,7 +49,7 @@ class mailMethodKolab extends mailMethodCyrus "lrswipcd" => "write", "lrswipcda"=> "admin", "lrswipkxtecda"=> "full-admin", - " " => "none"); + " " => "none"); public function fixAttributesOnLoad() { mailMethodCyrus::fixAttributesOnLoad(); @@ -78,7 +83,19 @@ class mailMethodKolab extends mailMethodCyrus $this->parent->attrs['objectClass'] = array_merge( $this->parent->attrs['objectClass'],$ocs); $this->parent->attrs['objectClass'] = array_unique($this->parent->attrs['objectClass']); $this->parent->attrs['gosaSharedFolderTarget'] =array(); - $this->parent->attrs['kolabDeleteFlag'] = $this->parent->gosaMailServer; + + + /* If the mail setup includes Master and Slave Kolab Server, then we have to remove the + * mailAccount from server, by adding a kolabDeleteflag for each server. + * */ + if($this->masterSlave){ + $this->parent->attrs['kolabDeleteflag'] = array(); + foreach($this->getKolabHost() as $md){ + $this->parent->attrs['kolabDeleteflag'][] = $md; + } + }else{ + $this->parent->attrs['kolabDeleteflag'] = $this->parent->gosaMailServer; + } if($this->folderTypesEnabled()){ $this->parent->attrs['kolabFolderType'] =array(); } @@ -233,6 +250,36 @@ class mailMethodKolab extends mailMethodCyrus } return(TRUE); } + + + + /*! \brief Returns all kolabHost entries from the k=kolab object. + @return See \brief + */ + public function getKolabHost() + { + $host = array(); + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=kolab)(k=kolab)(kolabHost=*))",array("kolabHost")); + + if($ldap->count() == 1){ + $attrs = $ldap->fetch(); + for($i=0; $i <$attrs['kolabHost']['count']; $i ++ ){ + $host[] = $attrs['kolabHost'][$i]; + } + @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "Found: ".trim(implode($host,", "),", ")."", + "Revceiving 'Mail hosts for kolab22'."); + }elseif($ldap->count() == 0){ + @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "No mailHost entries found. Check k=kolab and mailHost", + "Revceiving 'Mail hosts for kolab22'."); + }else{ + @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "Found more than one kolab configuration object. Giving up.", + "Revceiving 'Mail hosts for kolab22'."); + } + + return($host); + } }