From e653938a3c22a6c95d966d0f7ca71147bb95e6c6 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 28 Nov 2006 10:54:20 +0000 Subject: [PATCH] Fixed printGeneric select user/groups git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5232 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_selectUserToPrinterDialog.inc | 37 ++++++++++++++++++- plugins/admin/systems/printer.tpl | 4 +- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/plugins/admin/systems/class_selectUserToPrinterDialog.inc b/plugins/admin/systems/class_selectUserToPrinterDialog.inc index 9cb403b5d..8f1c8eca2 100644 --- a/plugins/admin/systems/class_selectUserToPrinterDialog.inc +++ b/plugins/admin/systems/class_selectUserToPrinterDialog.inc @@ -80,10 +80,43 @@ class selectUserToPrinterDialog extends plugin $this->regex=preg_replace("/\*\*/","*",$this->regex); } + + /* Get all departments within this subtree */ + $base = $this->config->current['BASE']; + $deps_res= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", array("users","groups"), $this->config->current['BASE'], + array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH); + + /* Load possible departments */ + $ui = get_userinfo(); + + /* Allowed user departments */ + $udeps = $ui->get_module_departments("users"); + + /* Allowed groups department */ + $gdeps = $ui->get_module_departments("groups"); + + /* Combine both arrays */ + $tdeps = array_unique(array_merge($udeps,$gdeps)); + + /* Create usable departments array */ + $ids = $this->config->idepartments; + $deps = array(); + foreach($deps_res as $dep){ + if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){ + $value = $ids[$dep['dn']]; + $deps[$dep['dn']] = $value; + } + } + if(!isset($deps[$this->depselect])){ + $this->depselect = key($deps); + } + + + $tmp_printers= $this->getPrinter(); natcasesort($tmp_printers); $smarty->assign("regexPrinter" , $this->regex); - $smarty->assign("deplistPrinter" , $this->config->idepartments);//deplist); + $smarty->assign("deplistPrinter" , $deps);;//deplist); $smarty->assign("depselectPrinter" , $this->depselect); $smarty->assign("gotoPrinters" , $tmp_printers); $smarty->assign("gotoPrinterKeys" , array_flip($tmp_printers)); @@ -93,7 +126,7 @@ class selectUserToPrinterDialog extends plugin $smarty->assign("tree_image" , get_template_path('images/tree.png')); $smarty->assign("infoimage" , get_template_path('images/info.png')); $smarty->assign("launchimage" , get_template_path('images/small_filter.png')); - $smarty->assign("deplist" , $this->config->idepartments); + $smarty->assign("deplist" , $deps); $display.= $smarty->fetch(get_template_path('selectUserToPrinterDialog.tpl', TRUE,dirname(__FILE__))); return($display); diff --git a/plugins/admin/systems/printer.tpl b/plugins/admin/systems/printer.tpl index 2639e9b4d..12836edcc 100644 --- a/plugins/admin/systems/printer.tpl +++ b/plugins/admin/systems/printer.tpl @@ -142,7 +142,9 @@ -- 2.30.2