Code

Re-added sambaAcctFlag X - Which tells us the password never expires.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 14 Sep 2009 09:24:39 +0000 (09:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 14 Sep 2009 09:24:39 +0000 (09:24 +0000)
- the flag is written now, but the gray out isn't implemented

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14247 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/samba/personal/samba/class_sambaAccount.inc
gosa-plugins/samba/personal/samba/samba3.tpl

index 4f0e5a093b19682f32f6779170cb35cf873d0655..8cf6e687c9ea9794b7870a3ad00599b6f8e8bb13 100644 (file)
@@ -92,6 +92,7 @@ class sambaAccount extends plugin
   /* Only used  for multiple edit */
   var $temporary_disable = FALSE;
   var $no_password_required = FALSE;
+  var $no_expiry = FALSE;
   var $multiple_sambaUserWorkstations = array();
 
   function sambaAccount (&$config, $dn= NULL)
@@ -620,6 +621,13 @@ class sambaAccount extends plugin
         $smarty->assign("flagsN", "");
     }
 
+    // check if password never expires
+    if (is_integer(strpos($this->sambaAcctFlags, "X"))) {
+        $smarty->assign("flagsX", "checked");
+    } else {
+        $smarty->assign("flagsX", "");
+    }
+
     if($this->samba3){
       if ($this->sambaPwdCanChange=="1"){
         $smarty->assign("flagsP", "checked");
@@ -675,7 +683,7 @@ class sambaAccount extends plugin
           "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF",
           "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives",
           "onnectclientprinters","defaultprinter","shadow","brokenconn",
-          "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable", 
+          "reconn","allow_pwchange","connectclientprinters","no_expiry","no_password_required","temporary_disable", 
           "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours",
           "workstation_list") as $attr){
       if(in_array($attr,$this->multi_boxes)){
@@ -1117,7 +1125,16 @@ class sambaAccount extends plugin
         $this->pwdCanChange= $tmp;
         $this->sambaPwdCanChange= $tmp;
       }
-      $tmp= "UX";
+      $tmp= "U";
+
+      $this->no_expiry = FALSE;
+      if (isset($_POST["no_expiry"])){
+        if ($_POST["no_expiry"] == 1){
+          $tmp.= "X";
+          $this->no_expiry = TRUE;
+        }
+      }
+
       $this->no_password_required = FALSE;
       if (isset($_POST["no_password_required"])){
         if ($_POST["no_password_required"] == 1){
@@ -1519,6 +1536,7 @@ class sambaAccount extends plugin
             "InheritClientConfig"         => _("Inherit client config"),
             "sambaPwdCanChange"           => _("Allow user to change password") ,
             "sambaAcctFlagsN"             => _("Login from windows client requires no password"),
+            "sambaAcctFlagsX"             => _("Password never expires"),
             "sambaAcctFlagsL"             => _("Lock samba account"),
             "sambaKickoffTime"            => _("Account expires") ,
             "sambaPwdMustChange"          => _("Password expires") ,
@@ -1548,7 +1566,7 @@ class sambaAccount extends plugin
             "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF",
             "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives",
             "onnectclientprinters","defaultprinter","shadow","brokenconn",
-            "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable",
+            "reconn","allow_pwchange","connectclientprinters","no_expiry","no_password_required","temporary_disable",
             "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours",
             "workstation_list") as $attr){
         if(isset($_POST["use_".$attr])){
@@ -1734,6 +1752,10 @@ class sambaAccount extends plugin
       $ret['no_password_required'] = $this->no_password_required;
     }
 
+    if(in_array("no_expiry",$this->multi_boxes)){
+      $ret['no_expiry'] = $this->no_expiry;
+    }
+
     if(in_array("temporary_disable",$this->multi_boxes)){
       $ret['temporary_disable'] = $this->temporary_disable;
     }
@@ -1852,6 +1874,16 @@ class sambaAccount extends plugin
       }
     }      
 
+    if(isset($values['no_expiry'])){
+      if($values['no_expiry']){
+        if(!preg_match("/N/",$this->sambaAcctFlags)) {
+          $this->sambaAcctFlags = preg_replace("/ /","N",$this->sambaAcctFlags,1);
+        }
+      }else{
+        $this->sambaAcctFlags = preg_replace("/N/"," ",$this->sambaAcctFlags,1);
+      }
+    }      
+
     if(isset($values['temporary_disable'])){
       if($values['temporary_disable']){
         if(preg_match("/L/",$this->sambaAcctFlags)) {
index 7cc5f29068eba53fffc7ccc749a0eb953db0c48f..a1cb6f9c71afd9d89ea359943e38bfbc497ffa58 100644 (file)
 
    <!-- Samba policies -->
    <table>
+    <tr>
+     <td colspan=2>
+      {render acl=$sambaAcctFlagsXACL  checkbox=$multiple_support checked=$use_no_expiry}
+       <input id="no_expiry" type=checkbox name="no_expiry" value="1" {$flagsX} class="center">
+      {/render}
+      <label for="no_expiry">{t}The password never expires{/t}</label>
+     </td>
+    </tr>
     <tr>
      <td colspan=2>
       {render acl=$sambaAcctFlagsNACL  checkbox=$multiple_support checked=$use_no_password_required}