Code

Updated mailAccount.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Jun 2008 11:27:27 +0000 (11:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Jun 2008 11:27:27 +0000 (11:27 +0000)
-Ensure that nobody uses a mail address already specified in kolabs alias attribute.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@11413 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/mail/class_mailAccount.inc

index fe0058d092c4b5b1bac3144e568892adb1b498d9..80f9ba64bea1bbf2f1d196d1bcecb9788627d22f 100644 (file)
@@ -987,7 +987,11 @@ class mailAccount extends plugin
       }
     }
     $ldap->cd($this->config->current['BASE']);
-    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".$this->mail."))(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid"));
+    $filter = "(&(!(objectClass=gosaUserTemplate))(!(uid=".$this->uid."))".
+      "(objectClass=gosaMailAccount)".
+      "(|(mail=".$this->mail.")(alias=".$this->mail.")(gosaMailAlternateAddress=".$this->mail.")))";
+
+    $ldap->search($filter,array("uid"));
     if ($ldap->count() != 0){
       $message[]= _("The primary address you've entered is already in use.");
     }
@@ -1077,10 +1081,11 @@ class mailAccount extends plugin
   {
     $ldap= $this->config->get_ldap_link();
     $address= strtolower($address);
-      
+     
     /* Is this address already assigned in LDAP? */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))", array("uid"));
+    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=$address)".
+      "(alias=$address)(gosaMailAlternateAddress=$address)))", array("uid"));
 
     if ($ldap->count() > 0){
       $attrs= $ldap->fetch ();