X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_goMailServer.inc;h=f72af1d2b7eb3a1e485bcf93cc07e631ce12daae;hb=96e561f68b807338f5f8923b665eb96376bd2f11;hp=1c0cdc17dbaf30daf0acfe6006fcd587c4a7063b;hpb=da473c00c00f0f4b4ac0a2fad8e2f6f03704be06;p=gosa.git diff --git a/plugins/admin/systems/class_goMailServer.inc b/plugins/admin/systems/class_goMailServer.inc index 1c0cdc17d..f72af1d2b 100644 --- a/plugins/admin/systems/class_goMailServer.inc +++ b/plugins/admin/systems/class_goMailServer.inc @@ -10,12 +10,10 @@ class goMailServer extends plugin{ var $objectclasses = array("goMailServer"); /* This class can't be assigned twice so it conflicts with itsself */ - var $conflicts = array("goMailServer"); - var $DisplayName = ""; var $dn = NULL; var $StatusFlag = "goMailServerStatus"; - var $attributes = array("goMailServerStatus","description","postfixHeaderSizeLimit", + var $attributes = array("description","postfixHeaderSizeLimit", "postfixMailboxSizeLimit","postfixMessageSizeLimit", "postfixMyDestinations","postfixMyDomain","postfixMyhostname", "postfixMyNetworks","postfixRelayhost","postfixTransportTable", @@ -38,6 +36,7 @@ class goMailServer extends plugin{ var $TransportProtocols = array(); var $Actions = array(); var $cn = ""; + var $conflicts = array("goMailServer","kolab"); function goMailServer($config,$dn) { @@ -112,18 +111,24 @@ class goMailServer extends plugin{ if(isset($this->attrs['postfixTransportTable'])){ $tmp = array(); unset($this->attrs['postfixTransportTable']['count']); - foreach($this->attrs['postfixTransportTable'] as $entry){ - $nr = preg_replace("/:.*$/","",$entry); - $rest= trim(preg_replace("/^[^:]+:/","",$entry)); - $src = preg_replace("/ .*$/","",$rest); - $rest= preg_replace("/^[^ ]+ /","",$rest); - $dst = preg_replace("/^.*:/","",$rest); - $prt = preg_replace("/:.*$/","",$rest); - - $tmp[$nr]['src'] = $src; - $tmp[$nr]['dst'] = $dst; - $tmp[$nr]['prt'] = $prt; - + foreach($this->attrs['postfixTransportTable'] as $entry){ + + //0: offshore.vip.ms-europa.lhsystems.com smtp:172.28.0.2 + + $Number = preg_replace('/^([^:]+):.*$/', '\\1', $entry); + $Rest = trim(preg_replace("/^[0-9]*:/","",$entry)); + + $Protocol_Destination = preg_replace("/^.*\ /","",$Rest); + $Source = preg_replace("/\ .*$/","",$Rest); + + $Protocol = preg_replace ('/^([^:]+):.*$/', '\\1' ,trim($Protocol_Destination)); + $Destination = preg_replace ('/^[^:]+:(.*)$/', '\\1' ,trim($Protocol_Destination)); + + $Destination = preg_replace ("/[\[\]]/","",$Destination); + + $tmp[$Number]['src'] = $Source; + $tmp[$Number]['dst'] = $Destination; + $tmp[$Number]['prt'] = $Protocol; } ksort($tmp); foreach($tmp as $entry){ @@ -477,9 +482,10 @@ class goMailServer extends plugin{ /* Return list entry */ function getListEntry() { + $this->updateStatusState(); $flag = $this->StatusFlag; $fields['Status'] = $this->$flag; - $fields['Message'] = _("Postfix")." ["._("configured for")." ".$this->postfixMyhostname."] "; + $fields['Message'] = _("Postfix"); $fields['AllowStart'] = true; $fields['AllowStop'] = true; $fields['AllowRestart'] = true; @@ -492,6 +498,13 @@ class goMailServer extends plugin{ function remove_from_parent() { plugin::remove_from_parent(); + + /* Remove status flag, it is not a memeber of + this->attributes, so ensure that it is deleted too */ + if(!empty($this->StatusFlag)){ + $this->attrs[$this->StatusFlag] = array(); + } + /* Check if this is a new entry ... add/modify */ $ldap = $this->config->get_ldap_link(); $ldap->cat($this->dn,array("objectClass")); @@ -502,7 +515,7 @@ class goMailServer extends plugin{ $ldap->cd($this->dn); $ldap->add($this->attrs); } - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing server services/mail with dn '%s' failed."),$this->dn)); $this->handle_post_events("remove"); } @@ -570,7 +583,7 @@ class goMailServer extends plugin{ $ldap->cd($this->dn); $ldap->add($this->attrs); } - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/mail with dn '%s' failed."),$this->dn)); if($this->initially_was_account){ $this->handle_post_events("modify"); }else{ @@ -598,7 +611,7 @@ class goMailServer extends plugin{ $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/mail with dn '%s' failed."),$this->dn)); $this->action_hook(); } } @@ -733,10 +746,57 @@ class goMailServer extends plugin{ } } + + /* Get updates for status flag */ + function updateStatusState() + { + if(empty($this->StatusFlag)) return; + + $attrs = array(); + $flag = $this->StatusFlag; + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->cn); + $ldap->cat($this->dn,array($flag)); + if($ldap->count()){ + $attrs = $ldap->fetch(); + } + if(isset($attrs[$flag][0])){ + $this->$flag = $attrs[$flag][0]; + } + } + function save_object() { plugin::save_object(); } + + + + /* Return plugin informations for acl handling */ + function plInfo() + { + return (array( + "plShortName" => _("Mail"), + "plDescription" => _("Mail service"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 0, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "description" => _("Description"), + "postfixHeaderSizeLimit" => _("Header size limit"), + "postfixMailboxSizeLimit" => _("Max mailbox size"), + "postfixMessageSizeLimit" => _("Max message size"), + "postfixMyDestinations" => _("Domains to accept mail for"), + "postfixMyNetworks" => _("Local networks"), + "postfixRelayhost" => _("Relay host"), + "postfixTransportTable" => _("Transport table"), + "postfixSenderRestrictions" => _("Restrictions for sender"), + "postfixRecipientRestrictions"=> _("Restrictions for recipient")) + )); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>