summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4dfc2b5)
raw | patch | inline | side by side (parent: 4dfc2b5)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 23 Oct 2006 09:43:50 +0000 (09:43 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 23 Oct 2006 09:43:50 +0000 (09:43 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4917 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc
index 5ace0cba5429e5f82528e969096116d8f6fbeec7..550e719991cc036a9955d983edb24279c90b7179 100644 (file)
$usedDiskNames[]= $key;
}
$this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames);
- $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn']));
+ $this->dialog->set_acl_base($this->acl_base_for_current_object($this->dn));
$this->dialog->set_acl_category("fai");
$this->dialog->FAIstate = $this->FAIstate;
$this->is_dialog = true;
$usedDiskNames[]= $key;
}
}
- $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]);
- $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 */
if(isset($this->disks[$Udisk]['dn'])){
$_SESSION['objectinfo'] = $this->disks[$Udisk]['dn'];
+ $dn = $this->disks[$Udisk]['dn'];
}else{
$_SESSION['objectinfo'] = "";
+ $dn = "new";
}
-
+
+ $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]);
+ $this->dialog->set_acl_base($this->acl_base_for_current_object($dn));
+ $this->dialog->set_acl_category("fai");
+ $this->dialog->FAIstate = $this->FAIstate;
+
$this->is_dialog = true;
}
$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("/c/",$this->ui->get_permissions($dn,"fai/faiPartitionTableEntry")) &&
!preg_match("/freeze/",$this->FAIstate));
$tmp = $this->plInfo();
foreach($tmp['plProvidedAcls'] as $name => $translated){
$smarty->assign($name."ACL",$this->getacl($name));
}
-
$disks = $this->getDisks();
$smarty->assign("disks" ,$disks);
$display.= $smarty->fetch(get_template_path('faiPartitionTable.tpl', TRUE));
*/
$a_return = array();
foreach($this->disks as $key => $disk){
- if($disk['status'] != "delete"){
- $cnt=0;
- foreach($disk['partitions'] as $val){
- if($val['status']!="delete"){
- $cnt ++;
- }
- }
- if(!empty($disk['description'])){
- if($cnt == 1){
- $a_return[$key]= $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition"), $cnt);
- }else{
- $a_return[$key]= $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition(s)"), $cnt);
+
+ $dn = "new";
+ if(isset($obj['dn'])){
+ $dn = $obj['dn'];
+ }
+ $dn = $this->acl_base_for_current_object($dn);
+ $acl = $this->ui->get_permissions($dn,"fai/faiPartitionTableEntry");
+ if(preg_match("/(r|w)/",$acl)) {
+
+ if($disk['status'] != "delete"){
+ $cnt=0;
+ foreach($disk['partitions'] as $val){
+ if($val['status']!="delete"){
+ $cnt ++;
+ }
}
- }else{
- if($cnt == 1){
- $a_return[$key]= $disk['cn'].", ".sprintf(_("%s partition"), $cnt);
+ if(!empty($disk['description'])){
+ if($cnt == 1){
+ $a_return[$key]= $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition"), $cnt);
+ }else{
+ $a_return[$key]= $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition(s)"), $cnt);
+ }
}else{
- $a_return[$key]= $disk['cn'].", ".sprintf(_("%s partition(s)"), $cnt);
+ if($cnt == 1){
+ $a_return[$key]= $disk['cn'].", ".sprintf(_("%s partition"), $cnt);
+ }else{
+ $a_return[$key]= $disk['cn'].", ".sprintf(_("%s partition(s)"), $cnt);
+ }
}
}
}
diff --git a/plugins/admin/fai/class_faiPartitionTableEntry.inc b/plugins/admin/fai/class_faiPartitionTableEntry.inc
index 9a3804a7e5b3a42d0204bb13b0492e547223a729..bef8d646bb235b2d5499b48498c7a64d2f86d967 100644 (file)
* The number specifies the index we want to delete
*/
foreach($_POST as $name => $value){
- if(preg_match("/Delete_.*/",$name)){
+ if((preg_match("/Delete_.*/",$name)) && $this->acl_is_removeable()){
$tmp = split("_",$name);
$s_action = "remove";
$s_entry = $tmp[1];
* We must sort the index again, else we possibly got problems
* with partitions order.
*/
- if($s_action == "remove"){
+ if($s_action == "remove" && $this->acl_is_removeable()){
if($this->partitions[$s_entry]['status'] == "edited"){
$this->deletePartitions[]= $this->partitions[$s_entry];
unset($this->partitions[$s_entry]);
/* To add a partitions we only append an empty
* array to the already defined partitions.
*/
- if(isset($_POST['AddPartition'])){
+ if(isset($_POST['AddPartition']) && $this->acl_is_createable()){
foreach($this->UsedAttrs as $attr){
$tmp[$attr] = "";
}
$smarty->assign($attr,$this->$attr);
}
- foreach($this->UsedAttrs as $attr){
- if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
- $smarty->assign($attr."ACL"," disabled ");
- }else{
- $smarty->assign($attr."ACL"," ");
+ $tmp = $this->plInfo();
+ $sacl = "";
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+
+ $acl = $this->getacl($name);
+ $sacl .= $acl;
+ if($this->FAIstate == "freezed"){
+ $acl = preg_replace("/w/","",$acl);
}
+ $smarty->assign($name."ACL",$acl);
}
-
-
- /* The user can't change a diskname
- * if we are currently in edit mode for the specified disk
- */
-// if($this->is_edit){
-// $smarty->assign("DISK_cnACL"," disabled ");
-// }else{
- $smarty->assign("DISK_cnACL","");
-// }
-
-
-
+ $smarty->assign("allowSave",$sacl);
+
+ $smarty->assign("sub_object_is_createable",$this->acl_is_createable());
+
/* Fetch template and show the result
*/
$display.= $smarty->fetch(get_template_path('faiPartitionTableEntry.tpl', TRUE));
$str = "<table summary='' style='width:100%'>";
if (count($this->partitions)){
$str .= "<tr>";
- $str .= "<td>"._("Type")."</td>";
- $str .= "<td>"._("FS type")."</td>";
- $str .= "<td>"._("Mount point")."</td>";
- $str .= "<td>"._("Size in MB")."</td>";
- $str .= "<td>"._("Mount options")."</td>";
- $str .= "<td>"._("FS option")."</td>";
- $str .= "<td>"._("Preserve")."</td>";
+ $str .= "<td><b>"._("Type")."</b></td>";
+ $str .= "<td><b>"._("FS type")."</b></td>";
+ $str .= "<td><b>"._("Mount point")."</b></td>";
+ $str .= "<td><b>"._("Size in MB")."</b></td>";
+ $str .= "<td><b>"._("Mount options")."</b></td>";
+ $str .= "<td><b>"._("FS option")."</b></td>";
+ $str .= "<td><b>"._("Preserve")."</b></td>";
$str .= "<td> </td>";
$str .= "</tr>";
}
}
if($part['status']!="delete"){
+
/* Generate Partition select box
*/
- $PartitionType = "<select name='FAIpartitionType_".$key."' id='FAIpartitionType_".$key."' ".$disableALL.">";
- foreach($PartitionTypes as $type => $PTname){
- if($part['FAIpartitionType'] == $type){
- $PartitionType .="<option value='".$type."' selected >".$PTname."</option>";
- }else{
- $PartitionType .="<option value='".$type."'>".$PTname."</option>";
- }
- }
- $PartitionType.="</select>";
+ $PartitionType = "";
+ if($this->acl_is_writeable("FAIpartitionType")){
+ $PartitionType = "<select name='FAIpartitionType_".$key."' id='FAIpartitionType_".$key."' ".$disableALL.">";
+ foreach($PartitionTypes as $type => $PTname){
+ if($part['FAIpartitionType'] == $type){
+ $PartitionType .="<option value='".$type."' selected >".$PTname."</option>";
+ }else{
+ $PartitionType .="<option value='".$type."'>".$PTname."</option>";
+ }
+ }
+ $PartitionType.="</select>";
+ }elseif($this->acl_is_readable("FAIpartitionType")){
+ $PartitionType = $part['FAIpartitionType'];
+ }
/* Generate fsType select box
*/
- $FAIfsType= "<select name='FAIfsType_".$key."' id='FAIfsType_".$key."' ".$dis." ".$disableALL.">";
- foreach($FAIfsTypes as $type){
- if($part['FAIfsType'] == $type){
- $FAIfsType .="<option value='".$type."' selected >".$type."</option>";
- }else{
- $FAIfsType .="<option value='".$type."'>".$type."</option>";
+ $FAIfsType= "";
+ if($this->acl_is_writeable("FAIfsType")){
+ $FAIfsType= "<select name='FAIfsType_".$key."' id='FAIfsType_".$key."' ".$dis." ".$disableALL.">";
+ foreach($FAIfsTypes as $type){
+ if($part['FAIfsType'] == $type){
+ $FAIfsType .="<option value='".$type."' selected >".$type."</option>";
+ }else{
+ $FAIfsType .="<option value='".$type."'>".$type."</option>";
+ }
+ }
+ $FAIfsType.="</select>";
+ }elseif($this->acl_is_readable("FAIfsType")){
+ $FAIfsType = $part['FAIfsType'];
+ }
+
+ foreach(array("FAImountPoint","FAIpartitionSize","FAImountOptions","FAIfsOptions") as $attr){
+ $$attr = "";
+ if($this->acl_is_writeable($attr)){
+ $$attr = "<input name='".$attr."_".$key."' ".$disableALL." ".$dis."
+ value='".$part[$attr]."' id='".$attr."_".$key."'>";
+
+ }elseif($this->acl_is_readable($attr)){
+ $$attr = $part[$attr];
}
- }
- $FAIfsType.="</select>";
+ }
+
$str .= "\n<tr>";
$str .= "\n<td>".$PartitionType."</td>";
$str .= "\n<td>".$FAIfsType."</td>";
- $str .= "\n<td><input name='FAImountPoint_".$key."' ".$disableALL." ".$dis." value='".$part['FAImountPoint']."' id='FAImountPoint_".$key."'></td>";
- $str .= "\n<td><input name='FAIpartitionSize_".$key."' ".$disableALL." ".$dis." value='".$part['FAIpartitionSize']."' id='FAIpartitionSize_".$key."' size=12></td>";
- $str .= "\n<td><input name='FAImountOptions_".$key."' ".$disableALL." ".$dis." value='".$part['FAImountOptions']."' id='FAImountOptions_".$key."' style='width:100px;'></td>";
- $str .= "\n<td><input name='FAIfsOptions_".$key."' ".$disableALL." ".$dis." value='".$part['FAIfsOptions']."' id='FAIfsOptions_".$key."' style='width:100px;'></td>";
+ $str .= "\n<td>".$FAImountPoint."</td>";
+ $str .= "\n<td>".$FAIpartitionSize."</td>";
+ $str .= "\n<td>".$FAImountOptions."</td>";
+ $str .= "\n<td>".$FAIfsOptions."</td>";
$changeState = "onClick=\"changeState('FAImountPoint_".$key."') ; ".
"changeState('FAIpartitionSize_".$key."') ; ".
"changeState('FAIfsType_".$key."') ; ".
"changeState('FAIfsOptions_".$key."') ; \"";
-
- if($part['FAIpartitionFlags']!=false){
- $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' checked ".$changeState." ".$disableALL."></td>";
+ if($this->acl_is_writeable("FAIpartitionFlags")){
+ if($part['FAIpartitionFlags']!=false){
+ $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' checked ".$changeState." ".$disableALL."></td>";
+ }else{
+ $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' ".$changeState." ".$disableALL."></td>";
+ }
+ }else{
+ if($part['FAIpartitionFlags']!=false){
+ $str .= "<td>"._("False")."</td>";
+ }else{
+ $str .= "<td>"._("True")."</td>";
+ }
+ }
+ if($this->acl_is_removeable()){
+ $str .= "\n<td><input type='submit' name='Delete_".$key."' value='"._("Remove")."' ".$disableALL."></td>";
}else{
- $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' ".$changeState." ".$disableALL."></td>";
+ $str .= "\n<td><input type='submit' name='restricted' disabled value='"._("Remove")."'></td>";
}
- $str .= "\n<td><input type='submit' name='Delete_".$key."' value='"._("Remove")."' ".$disableALL."></td>";
$str .= "\n</tr>";
}
}
if((isset($_POST['TableEntryFrameSubmitted'])) && ($this->FAIstate != "freeze") ){
plugin::save_object();
- /* Check base attributes */
- foreach($this->attributes as $attrs){
- if(isset($_POST[$attrs])){
- $this->$attrs = $_POST[$attrs];
- }
- }
-
foreach($this->partitions as $key => $part){
foreach($this->UsedAttrs as $attrs){
- if(isset($_POST[$attrs."_".$key])){
- $this->partitions[$key][$attrs] = $_POST[$attrs."_".$key];
- }else{
- $this->partitions[$key][$attrs] = false;
+
+ if($this->acl_is_writeable($attrs)){
+
+ if(isset($_POST[$attrs."_".$key])){
+ $this->partitions[$key][$attrs] = $_POST[$attrs."_".$key];
+ }else{
+ $this->partitions[$key][$attrs] = false;
+ }
}
}
}
index a62397906728ba7304354965c2f764842e0f999f..2b7ee4f0732a7668a46ec2736005b69b7982ff3d 100644 (file)
</LABEL>
</td>
<td>
- <input value="{$cn}" size="45" maxlength="80" disabled id="cn">
+{render acl=$cnACL}
+ <input value="{$cn}" size="45" maxlength="80" id='cn' disabled >
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
- <input value="{$description}" size="45" maxlength="80" name="description" id="description" {$descriptionACL}>
+{render acl=$descriptionACL}
+ <input value="{$description}" size="45" maxlength="80" name="description" id="description">
+{/render}
</td>
</tr>
</table>
<select name="disks[]" title="{t}Choose a disk to delete or edit{/t}" style="width:100%" size="20" id="SubObject" multiple>
{html_options options=$disks}
</select><br>
- <input type="submit" name="AddDisk" value="{t}Add{/t}" title="{t}Add{/t}" {$cnACL}>
- <input type="submit" name="EditDisk" value="{t}Edit{/t}" title="{t}Edit{/t}" >
- <input type="submit" name="DelDisk" value="{t}Delete{/t}" title="{t}Delete{/t}" {$cnACL}>
+{if $sub_object_is_addable}
+ <input type="submit" name="AddDisk" value="{t}Add{/t}" title="{t}Add{/t}">
+{else}
+ <input type="submit" name="AddDisk" value="{t}Add{/t}" title="{t}Add{/t}" disabled >
+{/if}
+
+ <input type="submit" name="EditDisk" value="{t}Edit{/t}" title="{t}Edit{/t}">
+ <input type="submit" name="DelDisk" value="{t}Delete{/t}" title="{t}Delete{/t}">
</td>
</tr>
</table>
diff --git a/plugins/admin/fai/faiPartitionTableEntry.tpl b/plugins/admin/fai/faiPartitionTableEntry.tpl
index 9ceab9439d3dcbcabd3826fe226f68c2eedd3838..1e17e156fe76627a0ab79edd96f172cc6fc60c59 100644 (file)
<td style='width:50%;border-right:1px solid #909090;'><LABEL for="DISK_cn">
{t}Name{/t}
</LABEL>{$must}
- <input value="{$DISK_cn}" size="45" maxlength="80" name="DISK_cn" id="DISK_cn" {$cnACL}>
+{render acl=$cnACL}
+ <input value="{$DISK_cn}" size="45" maxlength="80" name="DISK_cn" id="DISK_cn">
+{/render}
</td>
<td><LABEL for="DISK_description">
{t}Description{/t}
</LABEL>
- <input value="{$DISK_description}" size="45" maxlength="80" name="DISK_description" id="DISK_description" {$descriptionACL}>
+{render acl=$descriptionACL}
+ <input value="{$DISK_description}" size="45" maxlength="80" name="DISK_description" id="DISK_description">
+{/render}
</td>
</tr>
</table>
<h2><img class="center" alt="" src="images/editpaste.png" align="middle" title="{t}Partition entries{/t}"> {t}Partition entries{/t}</h2>
{$setup}
<br>
-<input type="submit" name="AddPartition" value="{t}Add partition{/t}" {$cnACL}>
+{if $sub_object_is_createable}
+ <input type="submit" name="AddPartition" value="{t}Add partition{/t}">
+{else}
+ <input type="submit" name="restricted" value="{t}Add partition{/t}" disabled>
+{/if}
<br>
<br>
<p class="seperator"> </p>
<br>
<div style="align:right;" align="right">
-<input type="submit" name="SaveDisk" value="{t}Save{/t}" {$cnACL}>
+{render acl=$allowSave}
+<input type="submit" name="SaveDisk" value="{t}Save{/t}">
+{/render}
<input type="submit" name="CancelDisk" value="{t}Cancel{/t}" >
</div>
<!-- Place cursor -->