From 0205663fd44e52285312fcdc06e96a6d864ffaa3 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 18 Sep 2006 04:03:09 +0000 Subject: [PATCH] Printer ACLs (Not finished) git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4698 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_printGeneric.inc | 48 +++-- plugins/admin/systems/printer.tpl | 211 +++++++++++-------- 2 files changed, 159 insertions(+), 100 deletions(-) diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index db8e40b1f..947c77820 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -49,7 +49,7 @@ class printgeneric extends plugin "gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter","gotoGroupPrinter"); var $objectclasses = array("top", "gotoPrinter"); - function printgeneric ($config, $dn= NULL,$parent = NULL) + function printgeneric ($config, $dn,$parent) { $this->config = $config; $this->dn = $dn; @@ -263,6 +263,21 @@ class printgeneric extends plugin } $smarty= get_smarty(); + + /* Assign acls */ + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL", $this->getacl($name)); + } + + /* Create base acls */ + $baseACL = $this->getacl("base"); + if(!$this->acl_is_moveable()) { + $baseACL = preg_replace("/w/","",$baseACL); + } + $smarty->assign("baseACL", $baseACL); + + $display=""; /* Tell smarty if this is a standalone object or a terminal / WS depending printer */ @@ -350,12 +365,9 @@ class printgeneric extends plugin /* Assign attributes */ foreach ($this->attributes as $attr){ - $smarty->assign($attr."ACL", chkacl($this->acl, $attr)); $smarty->assign("$attr", $this->$attr); } - $smarty->assign("baseACL", chkacl($this->acl,"base")); - if(isset($_POST['AddUser'])){ $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddUser"); } @@ -499,7 +511,7 @@ class printgeneric extends plugin }else{ $smarty->assign("desc" ,sprintf(_("This printer belongs to workstation %s. You can't rename this printer."),"".$this->cn."")); } - $smarty->assign("cnACL" ," disabled "); + $smarty->assign("cnACL" , $this->getacl("cn",true)); }else{ $smarty->assign("desc" ,""); } @@ -572,9 +584,23 @@ class printgeneric extends plugin { plugin::save_object(); $this->netConfigDNS->save_object(); + /* Save base, since this is no LDAP attribute */ - if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){ - $this->base= $_POST['base']; + if(isset($_POST['base'])){ + $this->set_acl_base('dummy,'.$_POST['base']); + if($this->acl_is_moveable()){ + + if(isset($this->config->idepartments[$_POST['base']])){ + $this->base = $_POST['base']; + if ($_POST['base'] != $this->base){ + $this->is_modified= TRUE; + } + } + }else{ + + print_red(sprintf(_("You are not allowed to move this object to '%s'."),LDAP::fix($_POST['base']))); + $this->set_acl_base('dummy,'.$this->base); + } } } @@ -606,10 +632,7 @@ class printgeneric extends plugin } if($this->BelongsTo == "Printer"){ - $ui= get_userinfo(); - $acl= get_permissions ($dn, $ui->subtreeACL); - $acl= get_module_permission($acl, "printer", $this->dn); - if (chkacl($acl, "create") != ""){ + if($this->acl_is_createable()){ $message[]= _("You have no permissions to create a printer on this 'Base'."); } } @@ -808,7 +831,8 @@ class printgeneric extends plugin "plCategory" => array("printer" => array("description" => _("Printer"), "objectClass" => "gotoPrinter")), "plProvidedAcls"=> array( - "cn" => _("Name"), + "cn" => _("Name"), + "description" => _("Description"), "l" => _("Location"), "labeledURI" => _("LabeledURL"), diff --git a/plugins/admin/systems/printer.tpl b/plugins/admin/systems/printer.tpl index 9b20e9278..2639e9b4d 100644 --- a/plugins/admin/systems/printer.tpl +++ b/plugins/admin/systems/printer.tpl @@ -1,59 +1,78 @@ - - - + - +
+
{if $StandAlone } -

{t}General{/t}

- - - - - - - - - - - - - - - - -
{$must}
 
{$must} - - {if $baseACL == ""} - - {else} - - {/if} -
-
+

{t}General{/t}

+ + + + + + + + + + + + + + + + +
{$must} +{render acl=$cnACL} + +{/render} +
+{render acl=$descriptionACL} + +{/render} +
 
{$must} +{render acl=$baseACL} + +{/render} +{render acl=$baseACL disable_picture='images/folder_gray.png'} + +{/render} +
+
{/if} -

{t}Details{/t}

- - - - - - - - - -
{$must}
- - - - -
-
- {t}Driver{/t}: {$driverInfo}  - - -
+

{t}Details{/t}

+ + + + + + + + + +
+{render acl=$lACL} + +{/render} +
{$must} +{render acl=$labeledURIACL} + +{/render} +
+ + + + +
+
+ {t}Driver{/t}: {$driverInfo}  +{render acl=$gotoPrinterPPDACL mode=read_active} + +{/render} +{render acl=$gotoPrinterPPDACL} + +{/render} +
@@ -62,41 +81,57 @@

{t}Permissions{/t}

- - - - + + + +
- - - - -
- {t}Users which are allowed to use this printer{/t}
-
- - - -
- -
- - - - -
- {t}Users which are allowed to administrate this printer{/t}
-
- - - - -
- -
+ + + + +
+ {t}Users which are allowed to use this printer{/t}
+{render acl=$gotoUserPrinterACL} +
+{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +
+ +
+ + + + +
+ {t}Users which are allowed to administrate this printer{/t}
+{render acl=$gotoUserPrinterACL} +
+{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +{render acl=$gotoUserPrinterACL} + +{/render} +{render acl=$gotoUserPrinterACL} + +{/render} + +
+ +
-- 2.30.2