From 57ed158ac812cafeab836134f4f91a78c88b7b1a Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 24 Jun 2008 11:33:08 +0000 Subject: [PATCH] Updated mailAccount. -Ensure that the entered mail address is uniq. (alias, mail, gosaMailAlternateAddress) git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11415 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../mail/personal/mail/class_mailAccount.inc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gosa-plugins/mail/personal/mail/class_mailAccount.inc b/gosa-plugins/mail/personal/mail/class_mailAccount.inc index aecfc14a1..f2f332f20 100644 --- a/gosa-plugins/mail/personal/mail/class_mailAccount.inc +++ b/gosa-plugins/mail/personal/mail/class_mailAccount.inc @@ -940,12 +940,18 @@ class mailAccount extends plugin $message[]= msgPool::invalid(_("Mail address"),"","","your-domain@your-domain.com"); } } + $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[]= msgPool::duplicated(_("Mail address")); } + /* Check quota */ if ($this->gosaMailQuota != '' && $this->acl_is_writeable("gosaMailQuota")){ if (!is_numeric($this->gosaMailQuota)) { @@ -1046,8 +1052,8 @@ class mailAccount extends plugin /* Is this address already assigned in LDAP? */ $ldap->cd ($this->config->current['BASE']); - $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))", array("uid")); - $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