diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc
index 8e29422fbb5ef3d965199278703e5bdc71ab07e2..0efc24c103d918707367f568079cf81cc2846e8c 100644 (file)
if (preg_match('/^_/', $disk['partitions'][$name]['FAIfsType'])){
$disk['partitions'][$name]['FAIfsType']= preg_replace('/^_/', '', $disk['partitions'][$name]['FAIfsType']);
- $disk['partitions'][$name]['FAIencrypted']= true;
- } else {
- $disk['partitions'][$name]['FAIencrypted']= false;
}
}
}
* The number specifies the index we want to delete
*/
foreach($_POST as $name => $value){
- if((preg_match("/Delete_.*/",$name)) && $this->acl_is_removeable()){
+ if((preg_match("/Delete_.*/",$name)) && $this->acl_is_removeable() && !preg_match("/freeze/i",$this->FAIstate)){
$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" && $this->acl_is_removeable()){
+ if($s_action == "remove" && $this->acl_is_removeable() && !preg_match("/freeze/i",$this->FAIstate)){
if($this->partitions[$s_entry]['status'] == "edited"){
$this->deletePartitions[$s_entry]= $this->partitions[$s_entry];
$this->deletePartitions[$s_entry]['FAIpartitionNr']=$s_entry;
/* To add a partitions we only append an empty
* array to the already defined partitions.
*/
- if(isset($_POST['AddPartition']) && $this->acl_is_createable()){
+ if(isset($_POST['AddPartition']) && $this->acl_is_createable() && !preg_match("/freeze/i",$this->FAIstate)){
foreach($this->UsedAttrs as $attr){
$tmp[$attr] = "";
}
$tmp["old_cn"] = "";
- $tmp["FAIencrypted"] = FALSE;
$tmp['status']="new";
$this->partitions[count($this->partitions)+1]=$tmp;
}
$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);
- }
+ $acl = $this->getacl($name, preg_match("/freeze/i",$this->FAIstate));
$smarty->assign($name."ACL",$acl);
}
- $smarty->assign("allowSave",$sacl);
$smarty->assign("sub_object_is_createable",$this->acl_is_createable());
+ $smarty->assign("freeze",preg_match("/freeze/i",$this->FAIstate));
/* Fetch template and show the result
*/
$str .= "<td><b>"._("Mount options")."</b></td>";
$str .= "<td><b>"._("FS option")."</b></td>";
$str .= "<td><b>"._("Preserve")."</b></td>";
- $str .= "<td><b>"._("Encrypted")."</b></td>";
$str .= "<td> </td>";
$str .= "</tr>";
}
}
$disableALL = "";
- if($this->FAIstate =="freeze"){
+ if (preg_match("/freeze/", $this->FAIstate)){
$disableALL = " disabled ";
}
}else{
$str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' ".$changeState." ".$disableALL."></td>";
}
- if($part['FAIencrypted']!=false){
- $str .= "\n<td><input type='checkbox' name='FAIencrypted_".$key."' value='encrypted' checked></td>";
- }else{
- $str .= "\n<td><input type='checkbox' name='FAIencrypted_".$key."' value='encrypted'></td>";
- }
}else{
if($part['FAIpartitionFlags']!=false){
$str .= "<td>"._("False")."</td>";
}else{
$str .= "<td>"._("True")."</td>";
}
- if($part['FAIencrypted']!=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>";
/* Attach partitions */
foreach($this->partitions as $key=>$val) {
- if (isset($this->partitions[$key]['FAIencrypted']) && $this->partitions[$key]['FAIencrypted']){
- unset ($this->partitions[$key]['FAIencrypted']);
- $this->partitions[$key]['FAIfsType']= "_".$this->partitions[$key]['FAIfsType'];
- }
$this->partitions[$key]['FAIpartitionNr']=$key;
}
/* Save data to object */
function save_object()
{
- if((isset($_POST['TableEntryFrameSubmitted'])) && ($this->FAIstate != "freeze") ){
+ if((isset($_POST['TableEntryFrameSubmitted'])) && !preg_match("/freeze/", $this->FAIstate) ){
plugin::save_object();
foreach($this->partitions as $key => $part){
}
}
- if($this->acl_is_writeable("FAIencrypted")){
-
- if(isset($_POST["FAIencrypted_".$key])){
- $this->partitions[$key]["FAIencrypted"] = $_POST["FAIencrypted_".$key];
- }else{
- $this->partitions[$key]["FAIencrypted"] = false;
- }
- }
-
/* Adapt ext3 to have -j option */
if ($this->partitions[$key]["FAIfsType"] == "ext3") {
$this->partitions[$key]["FAIfsOptions"]= preg_replace('/\s*-j\s*/', '', $this->partitions[$key]["FAIfsOptions"]);
$message= plugin::check();
/* Check for an empty disk name */
- if(empty($this->DISKcn)){
+ $d = trim($this->DISKcn);
+ if($d == "" ){
$message[] = msgPool::required(_("Name"));
}
+ if(preg_match("/[^a-z0-9_\-]/i",$d)){
+ $message[] = msgPool::invalid(_("Name"),$d,"/[a-z0-9_\-]/i");
+ }
/* check every partition.
* if there is an invalid value defined, append an errorstr to message
break;
case 2:
- if((!tests::is_id($tmp[0]))&&(!tests::is_id($tmp[1])) &&(!empty($tmp[1]))){
+ if( !tests::is_id($tmp[0]) && !tests::is_id($tmp[1]) && !empty($tmp[1]) ){
$message[]= msgPool::invalid(sprintf(_("partition %s size"),$key));
- }elseif($tmp[0]>=$tmp[1]){
+ }elseif(!empty($tmp[1]) && $tmp[0]>=$tmp[1]){
$message[]= msgPool::invalid(sprintf(_("partition %s size"),$key));
}
break;
"FAIpartitionSize" => _("Partition size"),
"FAImountOptions" => _("Mount options"),
"FAIfsOptions" => _("File system options"),
- "FAIencrypted" => _("File system encryption"),
"FAIpartitionFlags" => _("Partition flags"))
));
}