Code

Set DNS hidden if acount is disabled
[gosa.git] / plugins / personal / connectivity / class_kolabAccount.inc
index a7a609a5ad747c74f4374b7c4bb0b29fa291f169..2b5ae71c864e4d6a8fca2f7367dc92493ea134f6 100644 (file)
@@ -19,7 +19,7 @@ class kolabAccount extends plugin
 
   /* attribute list for save action */
   var $attributes= array( "kolabFreeBusyFuture", "unrestrictedMailSize", "calFBURL");
-  var $objectclasses= array();
+  var $objectclasses= array("kolab");
 
   /* Helper */
   var $imapping= array();
@@ -46,6 +46,9 @@ class kolabAccount extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+//     plugin::execute();
+
     /* Show tab dialog headers */
     $display= "";
 
@@ -105,7 +108,7 @@ class kolabAccount extends plugin
 
           $ldap= $this->config->get_ldap_link();
           $ldap->cd ($this->config->current['BASE']);
-          $ldap->search('(mail='.$address.')');
+          $ldap->search('(mail='.$address.')',array("mail"));
           if ($ldap->count() == 0){
             print_red (_("The mail address you're trying to add is no primary mail address of an existing user."));
           } else {
@@ -149,14 +152,20 @@ class kolabAccount extends plugin
     }
 
     /* Transfer account states for this union */
-    if ($this->parent->by_object['mailAccount']->is_account){
+    if (isset($this->parent) && $this->parent->by_object['mailAccount']->is_account){
       $smarty->assign('is_account', 'true');
     } else {
       $smarty->assign('is_account', '');
     }
 
     /* Transfer delegation list */
-    $smarty->assign("kolabDelegate", $this->kolabDelegate);
+    if (!count($this->kolabDelegate)){
+      /* Smarty will produce <option value=""></option> and tidy don't like that, so tell smarty to create no option (array();)*/
+      $smarty->assign("kolabDelegate", array());
+    } else {
+      $smarty->assign("kolabDelegate", $this->kolabDelegate);
+    }
+    $smarty->assign("kolabDelegateACL", chkacl($this->acl, $this->kolabDelegate));
 
     /* Create InvitationPolicy table */
     $invitation= "";
@@ -224,7 +233,7 @@ class kolabAccount extends plugin
     }
 
     /* Check for URL scheme... */
-    if ($this->calFBURL != "" && !preg_match('/^[^:/]+://[a-z0-9_/.+~-]+$/i', $this->calFBURL)){
+    if ($this->calFBURL != "" && !@preg_match('/^[^:/]+://[a-z0-9_/.+~-]+$/i', $this->calFBURL)){
       $message[]= _("The value specified as Free Busy Information URL is invalid.");
     }
 
@@ -245,7 +254,7 @@ class kolabAccount extends plugin
 
         $ldap= $this->config->get_ldap_link();
         $ldap->cd ($this->config->current['BASE']);
-        $ldap->search('(mail='.$address.')');
+        $ldap->search('(mail='.$address.')',array("mail"));
         if ($ldap->count() == 0){
           $message[]= sprintf(_("There's no mail user with address '%s' for your invitation policy!"), $address);
         } else {
@@ -288,12 +297,18 @@ class kolabAccount extends plugin
       $nr++;
     }
     
+    /* If this one is empty, preset with ACT_MANUAL for anonymous users */
+    if (count ($this->kolabInvitationPolicy) == 0){
+      $this->kolabInvitationPolicy= array("ACT_MANUAL");
+    }
+
   }
 
 
   /* Save to LDAP */
   function save()
   {
+    /* Check mailmethod before doing something useful */
     plugin::save();
 
     /* Transfer arrays */
@@ -303,7 +318,9 @@ class kolabAccount extends plugin
     /* Write back to ldap */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);
-    $ldap->modify($this->attrs);
+    $this->cleanup();
+$ldap->modify ($this->attrs); 
+
     show_ldap_error($ldap->get_error());
 
     /* Optionally execute a command after we're done */