From: hickert Date: Mon, 23 Oct 2006 03:51:47 +0000 (+0000) Subject: Some fai partition acls X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=02f34e5dd964edca4f2e4f77de4554a167c99274;p=gosa.git Some fai partition acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4913 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc index 5aecea065..5ace0cba5 100644 --- a/plugins/admin/fai/class_faiPartitionTable.inc +++ b/plugins/admin/fai/class_faiPartitionTable.inc @@ -20,6 +20,7 @@ class faiPartitionTable extends plugin var $dialog = NULL; // a dialog, e.g. new disk dialog var $FAIstate = ""; + var $ui; function faiPartitionTable ($config, $dn= NULL) { @@ -28,6 +29,8 @@ class faiPartitionTable extends plugin $this->acl ="#all#"; + $this->ui = get_userinfo(); + /* 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 disks from ldap ... and then the partition definitions for the disks. @@ -35,13 +38,6 @@ class faiPartitionTable extends plugin 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])){ @@ -107,6 +103,20 @@ class faiPartitionTable extends plugin ksort($this->disks); } + + function acl_base_for_current_object($dn) + { + if($dn == "new"){ + if($this->dn == "new"){ + $dn= $_SESSION['CurrentMainBase']; + }else{ + $dn = $this->dn; + } + } + return($dn); + } + + function execute() { /* Call parent execute */ @@ -126,7 +136,8 @@ class faiPartitionTable extends plugin $usedDiskNames[]= $key; } $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames); - $this->dialog->acl = $this->acl; + $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn'])); + $this->dialog->set_acl_category("fai"); $this->dialog->FAIstate = $this->FAIstate; $this->is_dialog = true; } @@ -150,7 +161,8 @@ class faiPartitionTable extends plugin } } $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); - $this->dialog->acl = $this->acl; + $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn'])); + $this->dialog->set_acl_category("fai"); $this->dialog->FAIstate = $this->FAIstate; /* Set object info string, which will be displayed in plugin info line */ @@ -256,8 +268,14 @@ class faiPartitionTable extends plugin } } - foreach($this->attributes as $attr){ - $smarty->assign($attr."ACL",chkacl($this->acl,$attr)); + $dn = $this->acl_base_for_current_object($this->dn); + $smarty->assign("sub_object_is_addable", + preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiScriptEntry")) && + !preg_match("/freeze/",$this->FAIstate)); + + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translated){ + $smarty->assign($name."ACL",$this->getacl($name)); } $disks = $this->getDisks(); @@ -495,15 +513,8 @@ class faiPartitionTable extends plugin "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( - "cn" => _("Name"), - "FAIpartitionType" => _("Partition type"), - "FAIpartitionNr" => _("Partition no."), - "FAIfsType" => _("File system type"), - "FAImountPoint" => _("Mount point"), - "FAIpartitionSize" => _("Partition size"), - "FAImountOptions" => _("Mount options"), - "FAIfsOptions" => _("File system options"), - "FAIpartitionFlags" => _("Partition flags")) + "cn" => _("Name")." ("._("Read only").")", + "description" => _("Description")) )); } } diff --git a/plugins/admin/fai/class_faiPartitionTableEntry.inc b/plugins/admin/fai/class_faiPartitionTableEntry.inc index cc2c0619c..9a3804a7e 100644 --- a/plugins/admin/fai/class_faiPartitionTableEntry.inc +++ b/plugins/admin/fai/class_faiPartitionTableEntry.inc @@ -410,6 +410,34 @@ class faiPartitionTableEntry extends plugin return ($message); } + + + + /* Return plugin informations for acl handling */ + function plInfo() + { + return (array( + "plShortName" => _("Partition table entry"), + "plDescription" => _("FAI partition table entry"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 27, + "plSection" => array("administration"), + "plCategory" => array("fai"), + "plProvidedAcls" => array( + "cn" => _("Name"), + "description" => _("Description"), + "FAIpartitionType" => _("Partition type"), + "FAIpartitionNr" => _("Partition no."), + "FAIfsType" => _("File system type"), + "FAImountPoint" => _("Mount point"), + "FAIpartitionSize" => _("Partition size"), + "FAImountOptions" => _("Mount options"), + "FAIfsOptions" => _("File system options"), + "FAIpartitionFlags" => _("Partition flags")) + )); + } + } diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc index 24bab5d13..b2a70eec4 100644 --- a/plugins/admin/fai/class_faiTemplateEntry.inc +++ b/plugins/admin/fai/class_faiTemplateEntry.inc @@ -137,7 +137,7 @@ class faiTemplateEntry extends plugin $smarty->assign($attr."ACL",$this->getacl($attr,preg_match("/freeze/",$this->FAIstate))); } - $display.= "

Fix / problen and ensure that size and content are correct if you download this template. Revision > 4582 (gosa-2.5 is already patched)

".$smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE)); + $display.= $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE)); return($display); }