From 99b159b8290e03c331c7628b9610bd56b76030a8 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 25 Feb 2009 10:40:22 +0000 Subject: [PATCH] Fixed rfc 2307bis problem git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13453 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/groups/class_groupGeneric.inc | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/gosa-core/plugins/admin/groups/class_groupGeneric.inc b/gosa-core/plugins/admin/groups/class_groupGeneric.inc index 59ad363be..1d0941340 100644 --- a/gosa-core/plugins/admin/groups/class_groupGeneric.inc +++ b/gosa-core/plugins/admin/groups/class_groupGeneric.inc @@ -617,6 +617,33 @@ class group extends plugin } } + /* Ensure that the requested object is known to the group class + */ + if(!isset($this->dnMapping[$uid])){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=gosaAccount)(uid=".$uid."))",array("dn", "uid","sn","givenName")); + if($ldap->count() == 0 ){ + msg_dialog::display(_("Error"), + sprintf(_("Cannot add uid '%s' to the group '%s'. Could not find matching user object."), + $uid,$this->cn), + ERROR_DIALOG); + return; + }elseif($ldap->count() >= 2){ + msg_dialog::display(_("Error"), + sprintf(_("Cannot add uid '%s' to the group '%s'. The uid is used more than once."), + $uid,$this->cn), + ERROR_DIALOG); + return; + }else{ + while($attrs = $ldap->fetch()){ + $this->dnMapping[$attrs['uid'][0]] = $attrs['dn']; + $this->members[$attrs['uid'][0]] = $this->createResultName($attrs); + $this->allusers[$attrs['uid'][0]]= $this->createResultName($attrs); + } + } + } + $this->memberUid[$uid]= $uid; } @@ -669,7 +696,7 @@ class group extends plugin if(!empty($filter)){ $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(|".$filter."))",array("dn", "uid","sn","givenName")); + $ldap->search("(&(objectClass=gosaAccount)(|".$filter."))",array("dn", "uid","sn","givenName")); while($attrs = $ldap->fetch()){ $this->dnMapping[$attrs['uid'][0]] = $attrs['dn']; $this->members[$attrs['uid'][0]] = $this->createResultName($attrs); -- 2.30.2