From 4b15fa47a3ff519b58144db12a792befc6ece146 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 12 Jan 2006 15:10:53 +0000 Subject: [PATCH] Added some searchfilter attributes, this should be a little faster git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2469 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/applications/class_applicationGeneric.inc | 2 +- plugins/admin/groups/class_groupApplication.inc | 2 +- plugins/admin/groups/class_groupGeneric.inc | 8 ++++---- plugins/admin/groups/class_groupMail.inc | 6 ++---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/plugins/admin/applications/class_applicationGeneric.inc b/plugins/admin/applications/class_applicationGeneric.inc index 58895c8ea..a018486a7 100644 --- a/plugins/admin/applications/class_applicationGeneric.inc +++ b/plugins/admin/applications/class_applicationGeneric.inc @@ -322,7 +322,7 @@ class application extends plugin /* Check for existing application */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->config->current["BASE"]); - $ldap->search("(&(objectClass=gosaApplication)(cn=$this->cn))"); + $ldap->search("(&(objectClass=gosaApplication)(cn=$this->cn))",array("cn")); $ldap->fetch(); if ($ldap->count() != 0 && $this->dn == "new"){ $message[]= _("There's already an application with this 'Name'."); diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index c899f0bff..05c1160e4 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -387,7 +387,7 @@ class appgroup extends plugin /* We've got the appname, get parameters from ldap */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))"); + $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))",array("gosaApplicationParameter")); if ($ldap->count() != 1){ print_red (_("The selected application name is not uniq. Please check your LDAP.")); } else { diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index 6cddc6321..64a49bf18 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -93,7 +93,7 @@ class group extends plugin $this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID); $ldap= $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); - $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))"); + $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase")); if ($ldap->count() != 0){ $attrs= $ldap->fetch(); $this->ridBase= $attrs['sambaAlgorithmicRidBase'][0]; @@ -521,7 +521,7 @@ class group extends plugin while(TRUE){ $sid= $this->SID."-".($gidNumber*2 + $this->ridBase+1); $ldap->cd($this->config->current['BASE']); - $ldap->search("(sambaSID=$sid)"); + $ldap->search("(sambaSID=$sid)",array("sambaSID")); if ($ldap->count() == 0){ break; } @@ -635,7 +635,7 @@ class group extends plugin /* Check for used 'cn' */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))"); + $ldap->search("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))",array("cn")); if ($ldap->count() != 0){ /* New entry? */ @@ -673,7 +673,7 @@ class group extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->config->current['BASE']); - $ldap->search ("($attrib=*)"); + $ldap->search ("($attrib=*)",array($attrib)); /* Get list of ids */ while ($attrs= $ldap->fetch()){ diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index 750437be9..ca5549fe3 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -625,8 +625,7 @@ class mailgroup extends plugin $message[]= _("Please enter a valid email addres in 'Primary address' field."); } $ldap->cd($this->config->current['BASE']); - $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=". - $this->mail."))(!(uid=".$this->cn."))(!(cn=".$this->cn.")))"); + $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".$this->mail."))(!(uid=".$this->cn."))(!(cn=".$this->cn.")))",array("uid")); if ($ldap->count() != 0){ $message[]= _("The primary address you've entered is already in use."); } @@ -715,8 +714,7 @@ class mailgroup extends plugin /* Is this address already assigned in LDAP? */ $ldap->cd ($this->config->current['BASE']); - $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)". - "(gosaMailAlternateAddress=$address)))"); + $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))",array("uid")); if ($ldap->count() > 0){ $attrs= $ldap->fetch (); -- 2.30.2