Code

Fixed user/group selection in printer dialog
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 28 Sep 2006 08:58:02 +0000 (08:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 28 Sep 2006 08:58:02 +0000 (08:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4809 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/class_selectUserToPrinterDialog.inc

index 72d099ca0d3513e42e7174071e3d86494b8a9d8c..d35b85ef818695eae249bccb7b03430ec4374607 100644 (file)
@@ -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();
index 91d1ca4597e64730796d8a8d6fc2fc7ee4a1583c..9cb403b5d74d45e33438606faedf65458b460c5d 100644 (file)
@@ -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;