Code

Added encrypted flag for partitions. Closes #285.
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Nov 2007 16:34:24 +0000 (16:34 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Nov 2007 16:34:24 +0000 (16:34 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7919 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiPartitionTableEntry.inc

index 038e54e473f65b7046b25e44f2993555169e4a08..3059d928e97ff96d4703058a7308718600c6a28e 100644 (file)
@@ -69,6 +69,13 @@ class faiPartitionTableEntry extends plugin
               $disk['partitions'][$name][$attr]="";  
             }
           }
+
+          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;
+          }
         }
       }
 
@@ -193,6 +200,7 @@ class faiPartitionTableEntry extends plugin
       $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>&nbsp;</td>";
       $str .= "</tr>";
     }
@@ -283,12 +291,22 @@ class faiPartitionTableEntry extends plugin
           }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>";    
@@ -313,6 +331,10 @@ class faiPartitionTableEntry extends plugin
 
     /* 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;
     }
 
@@ -355,6 +377,15 @@ class faiPartitionTableEntry extends plugin
             }
           }
         }
+
+        if($this->acl_is_writeable("FAIencrypted")){
+
+          if(isset($_POST["FAIencrypted_".$key])){
+            $this->partitions[$key]["FAIencrypted"] = $_POST["FAIencrypted_".$key];
+          }else{
+            $this->partitions[$key]["FAIencrypted"] = false;
+          }
+        }
       }
     }
   }
@@ -472,6 +503,7 @@ class faiPartitionTableEntry extends plugin
             "FAIpartitionSize"  => _("Partition size"),
             "FAImountOptions"   => _("Mount options"),
             "FAIfsOptions"      => _("File system options"),
+            "FAIencrypted"      => _("File system encryption"),
             "FAIpartitionFlags" => _("Partition flags"))
           ));
   }