Code

fixed problem with klicking apply more than once
[gosa.git] / plugins / admin / systems / class_servKolab.inc
index e98ce04a15c060ec11c53795543abc88e26efe44..c1e33222359f83e5d53b9e87fd89076d95105b0f 100644 (file)
@@ -6,40 +6,48 @@ class servkolab extends plugin {
   var $cli_description = "Some longer text\nfor help";
   var $cli_parameters = array("eins"=>"Eins ist toll", "zwei"=>"Zwei ist noch besser");
 
-
   var $postfix_mydomain                 = "";
   var $postfix_mydestination            = "";
-  var $postfix_mynetworks               = "";
-  var $postfix_enable_virus_scan        = "";
-  var $cyrus_autocreatequota            = "";
-  var $cyrus_quotawarn                  = "";
-  var $cyrus_admins                     = "";
-  var $cyrus_imap                       = "";
-  var $cyrus_pop3                       = "";
-  var $cyrus_imaps                      = "";
-  var $cyrus_pop3s                      = "";
-  var $cyrus_sieve                      = "";
-  var $apache_allow_unauthenticated_fb  = "";
-  var $proftpd_ftp                      = "";
-  var $apache_http                      = "";
-  var $kolabHost                        = array("");
-
-  var $attributes =  array("postfix_mydomain", "postfix_mydestination",
-        "postfix_mynetworks", "postfix_enable_virus_scan",
-        "cyrus_autocreatequota", "cyrus_admins", "cyrus_imap",
-        "cyrus_pop3", "cyrus_imaps", "cyrus_pop3s", "cyrus_sieve",
-        "apache_allow_unauthenticated_fb", "proftpd_ftp",
-        "apache_http", "cyrus_quotawarn", "kolabHost");
-
+  var $postfix_mynetworks               = "127.0.0.1/8";
+  var $postfix_enable_virus_scan        = "TRUE";
+  var $postfix_relayhost                = "";
+  var $postfix_mxrelayenabled           =  true;
+  var $postfix_allow_unauthenticated     = "FALSE";
+  var $cyrus_quotawarn                  = "80";
+  var $kolabFreeBusyFuture              = "1";
+  var $k                                = "kolab";
+  var $cyrus_admins                     = "TRUE";
+  var $cyrus_imap                       = "TRUE";
+  var $cyrus_pop3                       = "TRUE";
+  var $cyrus_imaps                      = "TRUE";
+  var $cyrus_pop3s                      = "TRUE";
+  var $cyrus_sieve                      = "TRUE";
+  var $apache_allow_unauthenticated_fb  = "TRUE";
+  var $proftpd_ftp                      = "TRUE";
+  var $apache_http                      = "TRUE";
+  var $kolabHost                        = array();
+  var $orig_cn                          = "";
+
+  var $attributes =  array("postfix_mydomain", "postfix_mydestination", "proftpd_ftp", "k",
+      "postfix_mynetworks", "postfix_enable_virus_scan", "postfix_relayhost", "apache_http",
+      "postfix_allow_unauthenticated", "cyrus_admins", "cyrus_imap","kolabFreeBusyFuture",
+      "cyrus_pop3", "cyrus_imaps", "cyrus_pop3s", "cyrus_sieve", "apache_allow_unauthenticated_fb",
+      "cyrus_quotawarn");
   var $objectclasses = array("top", "kolab");
 
+  /* Serverservice vars */
+  var $conflicts    = array("goImapServer","goMailServer");
+  var $DisplayName  = "Kolab mail service";
+  var $StatusFlag   = "";
+
   function servkolab($config, $dn = NULL) 
   {
-    echo "DN korrigieren<br>";
-    $this->dn = "k=kolab,".$config->current['BASE'];
-    
+    /* Setting the hostname and tell this Plugin that we are the kolab extension*/
+    $this->hostname = preg_replace('/^cn=([^,]+),.*$/', '\1', $dn);
+    $this->dn       = "k=kolab,".$config->current['BASE'];
+
+    /* Load variables, if given*/
     plugin::plugin($config, $this->dn);
-    $this->dn = $dn;
 
     /* Copy needed attributes */
     foreach($this->attributes as $val) {
@@ -48,201 +56,215 @@ class servkolab extends plugin {
         $this->$val = $this->attrs["$name"][0];
       }
     }
-  }
 
+    /* Toggle relayhost */
+    $this->postfix_mxrelayenabled = preg_match('/^\[/', $this->postfix_relayhost);
+    $this->postfix_relayhost      = preg_replace("/[\[\]]/","",$this->postfix_relayhost);
+
+    /* Is this Server a member of the Kolab extension or not ?*/ 
+    if(isset($this->attrs['kolabHost'])) {
+      $this->kolabHost= $this->attrs['kolabHost'];
+      unset($this->kolabHost['count']);
+    }
+    $this->is_account            = false;
+    $this->initially_was_account = false;
+    foreach($this->kolabHost as $host){
+      if($this->hostname == $host){
+        $this->is_account            = true;
+        $this->initially_was_account = true;
+      }
+    } 
 
+  }
 
 
-  /* If the Button remove Kolab extension is clicked, this will be called */
-  function RemoveAccount() 
+  function execute() 
   {
-  
-  gosa_log("Remove function");
-    
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
+    /* Call parent execute */
+    plugin::execute();
 
-    if ($ldap->dn_exists($this->dn)) {
-      $ldap->rmdir($this->dn);
-      show_ldap_error($ldap->get_error());
+    /***************  
+      Variable initialisation
+     ***************/  
+    
+    $smarty     = get_smarty();
+    $display    = "";
+    $ldap       = $this->config->get_ldap_link();
+
+
+    /* Assemble free/busy string */
+    $edit       = sprintf('<input name="kolabFreeBusyFuture" value="%s" %s type="text" maxlength="3" size="4">',
+                    $this->kolabFreeBusyFuture, 
+                    chkacl($this->acl, 'kolabFreeBusyFuture'));
+    $fbfuture   = sprintf(_("Include data from %s days in the past when creating free/busy lists"), $edit);
+
+    /* Assemble quota string */
+    $edit       = sprintf('<input name="cyrus_quotawarn" value="%s" type="text" maxlength="3" size="4" %s>',
+                    $this->cyrus_quotawarn, 
+                    chkacl($this->acl, 'cyrus_quotawarn'));
+    $quotastr   = sprintf(_("Warn users when using more than %s%% of their mail quota"), $edit);
+
+    /***************
+      Assign informations to smarty 
+     ***************/
+
+    /* Set relayhost and if we have MX lookup enabled*/
+    if($this->postfix_mxrelayenabled) {
+      $smarty->assign("RelayMxSupportCheck"," checked ");
+    } else {
+      $smarty->assign("RelayMxSupportCheck","");
     }
-  }
 
+    /* Initialize all attributes, that were submitted */
+    foreach($this->attributes as $val) 
+    {
+      $smarty->assign($val."ACL",chkacl($this->acl,str_replace("_","-",$val)));
 
+      /* Tell smarty which variables we are useing */
+      $smarty->assign($val, $this->$val);
+      if (($this->$val != "FALSE") && !empty($this->$val)){
+        $smarty->assign($val."Check", "checked");
+      } else {
+        $smarty->assign($val."Check", "");
+      }
+    }
 
+    $smarty->assign("fbfuture", $fbfuture);
+    $smarty->assign("quotastr", $quotastr);
 
+    /* Load Template */
+    $display.=$smarty->fetch(get_template_path('servkolab.tpl', TRUE));
+    return ($display);
+  }
 
-  /* this fucntion generates all needed attributes to start a new kolab extension */
-  function AddAccount() 
+  function remove_from_parent() 
   {
 
-    /* get the Ldap link, to test if there is an obeject with the same dn */
-    $ldap = $this->config->get_ldap_link();
-    
-    gosa_log("Add function");
-
-    /* test */
-    if (!$ldap->dn_exists($this->dn)) {
-      /* Object Classes */
-      $str['objectClass'][] = "top";
-      $str['objectClass'][] = "kolab";
-
-      /* specific kolab attribute */
-      $str['k'][] = "kolab";
-
-      /* Postfix default values */
-      $str['postfix-mydomain'][] = "gonicus.de";
-      $str['postfix-mydestination'][] = "\$mydomain";
-      $str['postfix-mynetworks'][] = "127.0.0.0/8";
-      $str['postfix-enable-virus-scan'][] = "TRUE";
-
-      /* Cyrus Attributes */
-      $str['cyrus-autocreatequota'][] = "100000";
-      $str['cyrus-quotawarn'][] = "80";
-      $str['cyrus-admins'][] = "manager";
-      $str['cyrus-imap'][] = "TRUE";
-      $str['cyrus-pop3'][] = "FALSE";
-      $str['cyrus-imaps'][] = "FALSE";
-      $str['cyrus-pop3s'][] = "FALSE";
-      $str['cyrus-sieve'][] = "FALSE";
-
-      /* */
-      $str['apache-allow-unauthenticated-fb'][] = "FALSE";
-      $str['proftpd-ftp'][] = "FALSE";
-      $str['uid'][] = "freebusy";
-      $str['userPassword'][] = "ZnJlZWJ1c3k";
-      $str['apache-http'][] = "TRUE";
-
-
-      /* Set Attributes */
-      $ldap->cd($this->dn);
-      $this->attrs = $str;
-
-      /* Copy needed attributes */
-      foreach($this->attributes as $val) {
-        $name = preg_replace('/_/', '-', $val);
-        if (isset($this->attrs["$name"][0])) {
-          $this->$val = $this->attrs["$name"][0];
-        }
-      }
-
+     /* 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();
     }
 
 
-  }
-
+    /* Only walk through following code, if this host 
+       was a member of the kolab hosts, else skip this */
+    if(!$this->initially_was_account){
+      return;
+    }
 
-  function execute() 
-  {
-    /* Fill templating stuff */
-    $smarty = get_smarty();
-    $display = "";
+    /* !!! Don't use "cn" in this function 
+       hostname -> the initial name of the host
+       cn       -> is the new name of the host, in case that it was renamed.
+     */
 
-    /* Tell the script the dn, we are using */
+    $ldap     = $this->config->get_ldap_link();
     $this->dn = "k=kolab,".$this->config->current['BASE'];
 
-    $ldap = $this->config->get_ldap_link();
-    
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])) {
-      $this->is_account = !$this->is_account;
-      if($this->is_account) 
-        $this->AddAccount();
-      else  
-        $this->RemoveAccount();   
-    
-    
-    }
+    /* We can't simply remove the whole entry, it is possible that there are 
+       some other hosts assigned to this object. 
+       So, first of all check if we are the last host entry within the host 
+       : Remove k=kolab entry 
+       if we aren't alone, only remove host name from hosts entry and save */
+    /* Are we alone? Remove complete entry... */
 
-    /* Show tab dialog headers */
-    if ($this->is_account) {
-      /* call Add Acoount to add account */
-      $display = $this->show_header(_("Remove Kolab extension"), _("This server has kolab features enabled. You can disable them by clicking below."));
-    } else {
-      /* call remove Account */
-      $display = $this->show_header(_("Add Kolab service"), _("This server has kolab features disabled. You can enable them by clicking below."));
-      return ($display);
+    /* Check if we are definitly in kolabHosts */
+    if(!in_array_ics($this->hostname,$this->kolabHost)) {
+      return;
     }
 
-    /* There a new Host submitted */
-    if (isset($_POST['NewHost'])) {
-      $this->attrs['kolabHost'][] = $_POST['NewkolabHost'];
-      gosa_log("Adding Host");
+    /* Integration check, not translatet because they can't pop up at all, only for debug */ 
+    if(count($this->kolabHost) == 0){
+      print_red("Server - Kolab tab : This is not possible, we can't remove an account which doesn't exists.");
+      return;
     }
-
-    /* We need to delete a Host */
-    if (isset($_POST['DelHost'])) {
-      foreach($this->attrs['kolabHost'] as $key => $host) {
-        if ($host == $_POST['kolabHost'])
-          unset($this->attrs['kolabHost'][$key]);
-      }
-      gosa_log("Removing Host".$this->attrs['kolabHost'][$key]);
+    if(!isset($this->hostname) || (empty($this->hostname))){
+      print_red("The required attribute hostname seams to empty.");
     }
 
+    /* Our hostname is in kolabHosts and there is a only one entry 
+       = we are the last host entry, delete k=kolab entry  */
+    if (count($this->kolabHost) == 1){
 
+      /* Remove complete entry */
+      $ldap->rmdir ($this->dn);
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing host entry from system server/kolab with dn '%s' failed."),$this->dn));
+      gosa_log("k=kolab entry removed, ".$this->hostname." was the last kolabHost entry.");
 
-    /* Initialize all attributes, that were submitted */
-    foreach($this->attributes as $val) {
-      /* If theres a button pressed, we need to check all attributes */
-      if ((isset($_POST['NewHost'])) || (isset($_POST['DelHost']))) {
-        /* Set var to value or to zero */
-        if (isset($_POST[$val])) {
+    } else {
 
-          $this->$val = $_POST[$val];
-        } else {
-          $this->$val = 0;
+      /* Only modify kolabHost */
+      $hosts= array();
+      foreach ($this->kolabHost as $host){
+        if($host != $this->hostname){
+          $hosts[]= $host;
         }
       }
-      /* Tell smarty which variables we are useing */
-      $smarty->assign($val, $this->$val);
-      if (($this->$val != "FALSE") && (!empty($this->$val)))
-        $smarty->assign($val."Check", "checked");
-
-    }
-
-    /*  If there are some Host submitted, tell it smarty */
-    $this->kolabHost = array();
-    if (isset($this->attrs['kolabHost'])) {
-      $this->kolabHost = $this->attrs['kolabHost'];
-      unset($this->kolabHost['count']);
+      $attrs= array('kolabHost' => $hosts);
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($attrs); 
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing host entry from system server/kolab with dn '%s' failed."),$this->dn));
+      gosa_log("Removing ".$this->hostname." from list of kolabHosts");
     }
 
-    $smarty->assign("kolabHost", $this->kolabHost);
-
-    /* Load Template */
-    $display.=$smarty->fetch(get_template_path('servkolab.tpl', TRUE));
-  
-    return ($display);
-  }
-
-  function remove_from_parent() 
-  {
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove");
   }
 
 
   function save_object()    
   {
-    plugin::save_object();
+    if (isset($_POST['kolabtab'])){
+      plugin::save_object();
+
+      /* Save checkboxes */
+      foreach (array( "postfix_enable_virus_scan", "postfix_allow_unauthenticated",
+            "cyrus_admins", "cyrus_imap", "cyrus_pop3", "cyrus_imaps",
+            "cyrus_pop3s", "cyrus_sieve", "apache_allow_unauthenticated_fb",
+            "proftpd_ftp", "apache_http") as $cb){
+        if (isset($_POST[$cb])){
+          $this->$cb= "TRUE";
+        } else {
+          $this->$cb= "FALSE";
+        }
+      }
+
+      /* Toggle relay check */
+      $this->postfix_mxrelayenabled= isset($_POST['RelayMxSupport']);
+    }
+
   }
 
 
   function check() 
   {
-    $message = array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
 
+    if(($this->kolabFreeBusyFuture==""))    {
+      $message[] = _("Future days in Free/Busy settings must be set.");
+    }elseif(!is_uid($this->kolabFreeBusyFuture) || $this->kolabFreeBusyFuture < 0){
+      $message[] = _("Future days in Free/Busy settings must be a positive value.");
+    }
 
     if(!is_int((int)($this->cyrus_quotawarn))) {
-      $message[] = "The given Quota settings value must be a number";
-    }elseif(!(($this->cyrus_quotawarn<=100)&&($this->cyrus_quotawarn>=1))){
-      $message[] = "Please choose a value between 1 and 100 for Quota settings";
+      $message[] = _("The given Quota settings value must be a number.");
+    }elseif(!(($this->cyrus_quotawarn<=100)&&($this->cyrus_quotawarn>=0))){
+      $message[] = _("Please choose a value between 1 and 100 for Quota settings.");
+    }elseif(strcasecmp($this->cyrus_quotawarn,(int)$this->cyrus_quotawarn)){
+      $message[] = _("Future days must be a value.");
     }
-    
 
-    /* You will need a least one entry to save this settings */
-    if (count($this->kolabHost) == 0) {
-      $message[] =
-        "You will need at least one Entry in Hosts. If You want to 'Remove' Kolab extension please use the \"Remove Kolab extension\"  Button to remove Kolab  ";
+    if(empty($this->postfix_mynetworks)) { 
+      $message[] = _("No SMTP privileged networks set.");
     }
+
+    /*if(empty($this->postfix_relayhost)) {
+      $message[] = _("No SMTP smarthost/relayhost set.");
+      }
+     */
+
     return ($message);
   }
 
@@ -251,90 +273,63 @@ class servkolab extends plugin {
   function save() 
   {
     /* Set ldap connection */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
+    $ldap       = $this->config->get_ldap_link();
 
-    /* Setup Attributes to save */
-    $newattrs = array();
+    /* Open current dn*/
+    $this->dn   = "k=kolab,".$this->config->current['BASE'];
 
-    /* Set vars with correct - _ - */
-    foreach($this->attributes as $key) {
-      $key2 = str_replace("_", "-", $key);
-      $newattrs[$key2] = $this->$key;
+    /* Adapt relayhost */
+    $this->postfix_relayhost= preg_replace('/[\[\]]/', '', $this->postfix_relayhost);
+    if (!$this->postfix_mxrelayenabled && $this->postfix_relayhost != ""){
+      $this->postfix_relayhost= "[".$this->postfix_relayhost."]";
     }
 
-    /* Set bool vars */
-    if ($newattrs['postfix-enable-virus-scan'] == 0)
-      $newattrs['postfix-enable-virus-scan'] = "FALSE";
-    else
-      $newattrs['postfix-enable-virus-scan'] = "TRUE";
-    if ($newattrs['cyrus-imap'] == 0)
-      $newattrs['cyrus-imap'] = "FALSE";
-    else
-      $newattrs['cyrus-imap'] = "TRUE";
-    if ($newattrs['cyrus-imaps'] == 0)
-      $newattrs['cyrus-imaps'] = "FALSE";
-    else
-      $newattrs['cyrus-imaps'] = "TRUE";
-    if ($newattrs['cyrus-pop3'] == 0)
-      $newattrs['cyrus-pop3'] = "FALSE";
-    else
-      $newattrs['cyrus-pop3'] = "TRUE";
-    if ($newattrs['cyrus-pop3s'] == 0)
-      $newattrs['cyrus-pop3s'] = "FALSE";
-    else
-      $newattrs['cyrus-pop3s'] = "TRUE";
-    if ($newattrs['cyrus-sieve'] == 0)
-      $newattrs['cyrus-sieve'] = "FALSE";
-    else
-      $newattrs['cyrus-sieve'] = "TRUE";
-    if ($newattrs['proftpd-ftp'] == 0)
-      $newattrs['proftpd-ftp'] = "FALSE";
-    else
-      $newattrs['proftpd-ftp'] = "TRUE";
-    if ($newattrs['apache-http'] == 0)
-      $newattrs['apache-http'] = "FALSE";
-    else
-      $newattrs['apache-http'] = "TRUE";
-    if ($newattrs['apache-allow-unauthenticated-fb'] == 0)
-      $newattrs['apache-allow-unauthenticated-fb'] = "FALSE";
-    else
-      $newattrs['apache-allow-unauthenticated-fb'] = "TRUE";
-
-
-    /* Reorder Host array, to get constant increasing index */
-    $newattrs['kolabHost'] = array();
-    foreach($this->attrs['kolabHost'] as $key=>$val) {
-      if (is_int($key)) {
-        $newattrs['kolabHost'][] = $val;
+    /* Check if this server was renamed, in this case we have to remove old cn first*/
+    if($this->hostname != $this->cn){
+      $tmp = array();
+      if(in_array_ics($this->hostname,$this->kolabHost)){
+        foreach($this->kolabHost as $host){
+          if($host != $this->hostname){
+            $tmp[] = $host;
+          }
+        }
+        $this->kolabHost = $tmp;
       }
     }
 
-    /* Save as following object ! */
-    $this->dn = "k=kolab,".$this->config->current['BASE'];
+    /* Add ourselves to the list of kolabHost's if needed */
+    if (!in_array_ics($this->cn,$this->kolabHost)){
+      $this->kolabHost[]= $this->cn;
+    }
 
-    /* If we already have an object like this one,
-       we only need to modify the entry
-     */
-    if ($ldap->dn_exists($this->dn)) {
-      gosa_log("Modifying");
-      $ldap->cd($this->dn);
-      $ldap->modify($newattrs);
+    /* Call parents save to prepare $this->attrs */
+    plugin::save();
+
+    /* Save or modify? */
+    $ldap->cat($this->dn, array('dn'));
+    if (!$ldap->fetch()){
+      $mode= "add"; 
     } else {
-      /* We must create a new Entry */
-      gosa_log("Adding");
-      $newattrs['k'] = "kolab";
-      $newattrs['uid'] = "freebusy";
-      $newattrs['postfix-mydomain'] = "gonicus.de";
-      $newattrs['postfix-mydestination'] = "\$mydomain";
-      $newattrs['userPassword'] = "tester";
-      $newattrs['objectClass'] = $this->objectclasses;
-      $ldap->cd($this->dn);
-      $ldap->add($newattrs);
+      $mode= "modify";
+    }
+
+    /* Do attribute conversion */
+    foreach ($this->attrs as $key => $value){
+      if (preg_match('/_/', $key)){
+        $old_key= $key;
+        $key= preg_replace('/_/', '-', $key);
+        $this->attrs[$key]= $value;
+        unset($this->attrs[$old_key]);
+      }
     }
+    /* Add kolab hosts */
+    $this->attrs['kolabHost']= $this->kolabHost;
 
-    /* show any errors */
-    show_ldap_error($ldap->get_error());
+    /* Perform LDAP action */
+    $ldap->cd($this->dn);
+    $this->cleanup();;
+    $ldap->$mode($this->attrs);
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/kolab with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
     if ($this->initially_was_account == $this->is_account) {
@@ -344,9 +339,103 @@ class servkolab extends plugin {
     } else {
       $this->handle_post_events("add");
     }
+  }
+
+
+  function getListEntry()
+  {
+    $this->updateStatusState();
+    $flag = $this->StatusFlag;
+    if(empty($flag)){
+      $fields['Status']       = "";
+    }else{
+      $fields['Status']       = $this->$flag;
+    }
+    $fields['Message']      = _("Kolab mail service");
+    $fields['AllowStart']   = true;
+    $fields['AllowStop']    = true;
+    $fields['AllowRestart'] = true;
+    $fields['AllowRemove']  = true;
+    $fields['AllowEdit']    = true;
+    return($fields);
+  }
+
+    /* Directly save new status flag */
+  function setStatus($value)
+  { 
+    return;
+  
+    if($value == "none") return;
+    if(!$this->initially_was_account) return;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+
+      $tmp = $ldap->fetch();
+      for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
+        $attrs['objectClass'][] = $tmp['objectClass'][$i];
+      }
+      $flag = $this->StatusFlag;
+      $attrs[$flag] = $value;
+      $this->$flag = $value;
+      $ldap->modify($attrs);
+      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for system server/kolab with dn '%s' failed."),$this->dn)); 
+      $this->action_hook();
+    }
+  }
+
+
+  /* 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];
+    }
   }
 
+
+
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Kolab"),
+          "plDescription" => _("Kolab service"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "postfix_mydomain"                => _("Postfix mydomain") ,
+            "postfix_mydestination"           => _("My destination") ,
+            "proftpd_ftp"                     => _("FTP FreeBusy service") ,
+            "postfix_mynetworks"              => _("SMTP privileged networks") ,
+            "postfix_enable_virus_scan"       => _("Enable virus scan") ,
+            "postfix_relayhost"               => _("Relayhost") ,
+            "apache_http"                     => _("HTTP FreeBusy service") ,
+            "postfix_allow_unauthenticated"   => _("Accept Internet Mail") ,
+            "cyrus_imap"                      => _("IMAP service") ,
+            "kolabFreeBusyFuture"             => _("kolabFreeBusyFuture") ,
+            "cyrus_pop3"                      => _("POP3 service") ,
+            "cyrus_imaps"                     => _("IMAP/SSL service") ,
+            "cyrus_pop3s"                     => _("POP3/SSL service") ,
+            "cyrus_sieve"                     => _("Sieve service") ,
+            "cyrus_quotawarn"                 => _("Quota settings")) 
+            ));
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: