From 00b468431463c40bac4549ef66ec7b8fff3613ac Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 19 Jun 2009 05:59:28 +0000 Subject: [PATCH] Updated ppd edit dialog. -If a printer was new, we weren't able to add a ppd driver. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13735 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/goto/class_printGeneric.inc | 17 ++++++++++++++--- .../systems/ppd/class_printerPPDDialog.inc | 8 ++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc index 117f5ee61..9473158f3 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc @@ -433,7 +433,7 @@ class printgeneric extends plugin if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){ $this->dialog = $this->PPDdialogToSave; }else{ - + if(is_array($this->gotoPrinterPPD)){ $this->dialog = new printerPPDDialog($this->config, $this->dn,""); }else{ @@ -441,6 +441,16 @@ class printgeneric extends plugin } $this->dialog->cn= $this->cn; } + + // Detect edit acl base + $ldap = $this->config->get_ldap_link(); + if($ldap->dn_exists($this->dn)){ + $acl_base = $this->dn; + }else{ + $acl_base = $this->base; + } + + $this->dialog->set_acl_base($acl_base); } /* remove ppd */ @@ -803,6 +813,7 @@ class printgeneric extends plugin /* save ppd configuration */ if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){ + $this->PPDdialogToSave->save_ppd(); /* Rename the generated ppd to match the gzip ending '.gz', if necessary. @@ -823,7 +834,7 @@ class printgeneric extends plugin } } } - if($this->orig_dn != $this->dn){ + if($this->orig_dn != $this->dn && $this->orig_dn != "new"){ if(!empty($this->gotoPrinterPPD)) { $this->PPDdialogToSave = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD); $this->PPDdialogToSave->cn = $this->cn; @@ -841,7 +852,7 @@ class printgeneric extends plugin } /* If no ppd is selected, remove this attribute */ - if(!empty($this->gotoPrinterPPD) && $this->initially_was_account) { + if(!empty($this->gotoPrinterPPD)) { $this->gotoPrinterPPD = $this->ppdServerPart.'/'.$this->gotoPrinterPPD; }else{ $this->gotoPrinterPPD = array(); diff --git a/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc b/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc index 8fa944bcd..be43f441a 100644 --- a/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc +++ b/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc @@ -96,9 +96,9 @@ class printerPPDDialog extends plugin $smarty->assign("ppdString", _("Can't get ppd informations.")); $smarty->assign("showOptions", ""); $smarty->assign("path_valid", TRUE); - $smarty->assign("acl",$this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD")); + $smarty->assign("acl",$this->ui->get_permissions($this->acl_base,"printer/printgeneric","gotoPrinterPPD")); - $acl = $this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD"); + $acl = $this->ui->get_permissions($this->acl_base,"printer/printgeneric","gotoPrinterPPD"); if(empty($this->pathToPPD)){ @@ -389,7 +389,7 @@ class printerPPDDialog extends plugin return; } - if(preg_match("/w/",$this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD"))){ + if(preg_match("/w/",$this->ui->get_permissions($this->acl_base,"printer/printgeneric","gotoPrinterPPD"))){ foreach($this->ppdConfig as $cat => $obj){ foreach($obj as $attr => $attributes){ if(isset($_POST[base64_encode($attributes['_name'])])){ @@ -493,7 +493,7 @@ class printerPPDDialog extends plugin } $acl =""; - if(!preg_match("/w/",$this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD"))){ + if(!preg_match("/w/",$this->ui->get_permissions($this->acl_base,"printer/printgeneric","gotoPrinterPPD"))){ $acl = "disabled"; } -- 2.30.2