From 36132efb753e98b9e0779defb4f991316333eb7c Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 24 Jun 2008 11:27:27 +0000 Subject: [PATCH] Updated mailAccount. -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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index fe0058d09..80f9ba64b 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -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 (); -- 2.30.2