From 1f8c80a6005e94853889c1b467ebffbd56e3bca9 Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 6 Oct 2006 06:22:23 +0000 Subject: [PATCH] =?utf8?q?Tolle=20=C3=84nderungen=20f=C3=BCr=20ein=20tolle?= =?utf8?q?s=20Projekt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4860 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiVariable.inc | 60 ++++++++++++-------- plugins/admin/fai/class_faiVariableEntry.inc | 20 +++++++ plugins/admin/fai/faiVariable.tpl | 20 +++++-- 3 files changed, 71 insertions(+), 29 deletions(-) diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index 0ab95a14d..45244b5c2 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -41,23 +41,9 @@ class faiVariable extends plugin /* Load Attributes */ plugin::plugin ($config, $dn); - $this->acl ="#all#"; - - /* If "dn==new" we try to create a new entry - * Else we must read all objects from ldap which belong to this entry. - * First read SubObjects from ldap ... and then the partition definitions for the SubObjects. - */ - if($dn != "new"){ $this->dn =$dn; - /* Set acls - */ - $ui = get_userinfo(); - $acl = get_permissions ($this->dn, $ui->subtreeACL); - $acli = get_module_permission($acl, "FAIclass", $this->dn); - $this->acl=$acli; - /* Get FAIstate */ if(isset($this->attrs['FAIstate'][0])){ @@ -113,7 +99,8 @@ class faiVariable extends plugin /* Add new sub object */ if(isset($_POST['AddSubObject'])){ $this->dialog= new $this->subClassName($this->config,"new"); - $this->dialog->acl = $this->acl; + $this->dialog->sel_acl_base($_SESSION['CurrentMainBase']); + $this->dialog->set_acl_category("fai"); $this->is_dialog=true; } @@ -126,8 +113,13 @@ class faiVariable extends plugin if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){ $var = $_POST['SubObject'][0]; + $c_dn = $this->SubObjects[$var]['dn']; + if($c_dn=="new"){ + $c_dn = $_SESSION['CurrentMainBase']; + } $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$var]); - $this->dialog->acl = $this->acl; + $this->dialog->set_acl_category("fai"); + $this->dialog->set_acl_base($c_dn); $_SESSION['objectinfo'] = $this->SubObjects[$var]['dn']; $this->is_dialog=true; } @@ -135,10 +127,19 @@ class faiVariable extends plugin /* Remove Sub object */ if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){ foreach($_POST['SubObject'] as $var){ - if($this->SubObjects[$var]['status'] == "edited"){ - $this->SubObjects[$var]['status']= "delete"; - }else{ - unset($this->SubObjects[$var]); + + $c_dn = $this->SubObjects[$var]['dn']; + if($c_dn=="new"){ + $c_dn = $_SESSION['CurrentMainBase']; + } + $ui = get_userinfo(); + $acl = $ui->get_permissions($c_dn,"fai/faiVariable"); + if(preg_match("/d/",$acl)){ + if($this->SubObjects[$var]['status'] == "edited"){ + $this->SubObjects[$var]['status']= "delete"; + }else{ + unset($this->SubObjects[$var]); + } } } } @@ -210,11 +211,21 @@ class faiVariable extends plugin } } - foreach($this->attributes as $attr){ - $smarty->assign($attr."ACL",chkacl($this->acl,$attr)); + $this->ui = get_userinfo(); + $c_dn = $this->dn; + if($c_dn == "new"){ + $c_dn = $_SESSION['CurrentMainBase']; } + $smarty->assign("is_createable", preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && $this->FAIstate!="freeze"); + $smarty->assign("is_removeable", preg_match("/d/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && $this->FAIstate!="freeze"); + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation) { + $smarty->assign($name."ACL",$this->getacl($name)); + } + + $display.= $smarty->fetch(get_template_path('faiVariable.tpl', TRUE)); return($display); } @@ -389,9 +400,8 @@ class faiVariable extends plugin "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( - "cn" => _("Name"), - "description" => _("Description"), - "FAIvariableContent"=> _("Variable content")) + "cn" => _("Name")." ("._("Read only").")", + "description" => _("Description")) )); } } diff --git a/plugins/admin/fai/class_faiVariableEntry.inc b/plugins/admin/fai/class_faiVariableEntry.inc index 5a0e04f2e..aed508d30 100644 --- a/plugins/admin/fai/class_faiVariableEntry.inc +++ b/plugins/admin/fai/class_faiVariableEntry.inc @@ -121,6 +121,26 @@ class faiVariableEntry extends plugin $tmp['status'] = $this->status; return($tmp); } + + /* Return plugin informations for acl handling */ + function plInfo() + { + return (array( + "plShortName" => _("Variable entry"), + "plDescription" => _("FAI variable entry "), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 23, + "plSection" => array("administration"), + "plCategory" => array("fai"), + "plProvidedAcls" => array( + "cn" => _("Name"), + "description" => _("Description"), + "FAIvariableContent"=> _("Variable content") ) + )); + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/fai/faiVariable.tpl b/plugins/admin/fai/faiVariable.tpl index 3eff2719e..10b09f67c 100644 --- a/plugins/admin/fai/faiVariable.tpl +++ b/plugins/admin/fai/faiVariable.tpl @@ -10,7 +10,9 @@ +{render acl=$cnACL} +{/render} @@ -20,7 +22,9 @@ - +{render acl=$descriptionACL} + +{/render} @@ -41,9 +45,17 @@ style="width:100%;" size="20" id="SubObject"> {html_options options=$SubObjects}
- - - +{if $is_createable} + +{else} + +{/if} + +{if $is_removeable} + +{else} + +{/if} -- 2.30.2