From: hickert Date: Thu, 28 Sep 2006 08:58:02 +0000 (+0000) Subject: Fixed user/group selection in printer dialog X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ca39a99d4f73149f85dcd62994b5ce77718836ef;p=gosa.git Fixed user/group selection in printer dialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4809 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 72d099ca0..d35b85ef8 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -349,7 +349,7 @@ class printgeneric extends plugin /* Base select dialog */ $once = true; foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once){ + if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){ $once = false; $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); $this->dialog->setCurrentBase($this->base); @@ -824,6 +824,7 @@ class printgeneric extends plugin function generateList(){ $a_return=array(); + foreach($this->member as $type => $values){ $a_return[$type]=array(); foreach($values as $value){ @@ -912,7 +913,7 @@ class printgeneric extends plugin $ldap = $this->config->get_ldap_link(); $ldap->cd($dn); - $ldap->cat($dn,array($var)); + $ldap->cat($dn,array($var,"cn")); if($ldap->count()){ $attrs = $ldap->fetch(); diff --git a/plugins/admin/systems/class_selectUserToPrinterDialog.inc b/plugins/admin/systems/class_selectUserToPrinterDialog.inc index 91d1ca459..9cb403b5d 100644 --- a/plugins/admin/systems/class_selectUserToPrinterDialog.inc +++ b/plugins/admin/systems/class_selectUserToPrinterDialog.inc @@ -20,7 +20,8 @@ class selectUserToPrinterDialog extends plugin var $searchAppend = ""; var $baseAddition = ""; var $type = ""; - + var $search_cat = ""; + function selectUserToPrinterDialog ($config, $dn= NULL,$type=false ) { plugin::plugin ($config, $dn); @@ -32,24 +33,28 @@ class selectUserToPrinterDialog extends plugin $this->searchAttrs = array("cn","uid"); $this->searchAppend = "uid"; $this->baseAddition = get_people_ou(); + $this->search_cat = "users"; ;break; case "AddGroup" : $this->searchObjects = "(objectClass=posixGroup)"; $this->searchAttrs = array("cn","description"); $this->searchAppend = "cn"; $this->baseAddition = get_groups_ou(); + $this->search_cat = "groups"; ;break; case "AddAdminUser" : $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))"; $this->searchAttrs = array("cn","uid"); $this->searchAppend = "uid"; $this->baseAddition = get_people_ou(); + $this->search_cat = "users"; ;break; case "AddAdminGroup" : $this->searchObjects = "(objectClass=posixGroup)"; $this->searchAttrs = array("cn","description"); $this->searchAppend = "cn"; $this->baseAddition = get_groups_ou(); + $this->search_cat = "groups"; ;break; } $this->type = $type; @@ -122,11 +127,14 @@ class selectUserToPrinterDialog extends plugin function getPrinter($detailed = false) { $a_return=array(); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->depselect); - #$ldap->search("(&".$this->searchObjects."(cn=".$this->regex."))", $this->depselect, $this->searchAttrs); - $ldap->ls("(&".$this->searchObjects."(cn=".$this->regex."))", $this->baseAddition.$this->depselect, $this->searchAttrs); - while($printer = $ldap->fetch()){ + + $filter = "(&".$this->searchObjects."(cn=".$this->regex."))"; + $base = $this->baseAddition.$this->depselect; + $attrs = $this->searchAttrs; + $cat = $this->search_cat; + + $res = get_list($filter,$cat,$base,$attrs); + foreach($res as $printer){ if(($detailed ==true)){ if(isset($printer[$this->searchAppend])){ $a_return[$printer[$this->searchAppend][0]] = $printer;