Code

Upadted heimdal tpl.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Dec 2007 11:56:13 +0000 (11:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Dec 2007 11:56:13 +0000 (11:56 +0000)
Not finished yet

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

ihtml/themes/default/pwd_heimdal.tpl [new file with mode: 0644]
include/class_password-methods-heimdal.inc

diff --git a/ihtml/themes/default/pwd_heimdal.tpl b/ihtml/themes/default/pwd_heimdal.tpl
new file mode 100644 (file)
index 0000000..006deca
--- /dev/null
@@ -0,0 +1,97 @@
+
+<table style="width:100%;">
+       <tr>
+               <td style="width:50%;vertical-align:top;">
+                       <h2>{t}Heimdal options{/t}</h2>
+                       <table>
+                               <tr>
+                                       <td>
+                                               <label for="unlimited_krb5MaxLife">{t}Max life{/t}</label>
+                                       </td>
+                                       <td>
+                                               <input id="unlimited_krb5MaxLife" name="unlimited_krb5MaxLife" value="1"  type="checkbox" 
+                                                       {if $unlimited_krb5MaxLife} checked {/if} onClick="changeState('krb5MaxLife');">
+                                               <input id="krb5MaxLife" type="text" name="krb5MaxLife" value="{$krb5MaxLife}" 
+                                                       {if $unlimited_krb5MaxLife} disabled {/if}>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <label for="unlimited_krb5MaxRenew">{t}Max renew{/t}</label>
+                                       </td>
+                                       <td>
+                                               <input id="unlimited_krb5MaxRenew" name="unlimited_krb5MaxRenew" value="1"  type="checkbox" 
+                                                       {if $unlimited_krb5MaxRenew} checked {/if} onClick="changeState('krb5MaxRenew');">
+                                               <input id="krb5MaxRenew" type="text" name="krb5MaxRenew" value="{$krb5MaxRenew}" 
+                                                       {if $unlimited_krb5MaxRenew} disabled {/if}>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <label for="unlimited_krb5ValidStart">{t}Valid start{/t}</label>
+                                       </td>
+                                       <td>
+                                               <input id="unlimited_krb5ValidStart" name="unlimited_krb5ValidStart" value="1"  type="checkbox" 
+                                                       {if $unlimited_krb5ValidStart} checked {/if} onClick="changeState('krb5ValidStart');">
+                                               <input id="krb5ValidStart" type="text" name="krb5ValidStart" value="{$krb5ValidStart}" 
+                                                       {if $unlimited_krb5ValidStart} disabled {/if}>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <label for="unlimited_krb5ValidEnd">{t}Valid end{/t}</label>
+                                       </td>
+                                       <td>
+                                               <input id="unlimited_krb5ValidEnd" name="unlimited_krb5ValidEnd" value="1"  type="checkbox"
+                                                       {if $unlimited_krb5ValidEnd} checked {/if} onClick="changeState('krb5ValidEnd');">
+                                               <input id="krb5ValidEnd" type="text" name="krb5ValidEnd" value="{$krb5ValidEnd}" 
+                                                       {if $unlimited_krb5ValidEnd} disabled {/if}>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <label for="unlimited_krb5PasswordEnd">{t}Password end{/t}</label>
+                                       </td>
+                                       <td>
+                                               <input id="unlimited_krb5PasswordEnd" name="unlimited_krb5PasswordEnd" value="1"  type="checkbox"
+                                                       {if $unlimited_krb5PasswordEnd} checked {/if} onClick="changeState('krb5PasswordEnd');">
+                                               <input id="krb5PasswordEnd" type="text" name="krb5PasswordEnd" value="{$krb5PasswordEnd}" 
+                                                       {if $unlimited_krb5PasswordEnd} disabled {/if}>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>   
+               <td>
+                       <h2>Flags</h2>
+                       <table>
+                               <tr>
+                                       <td style="width:120px;">
+<input {if $krb5KDCFlags_0} checked {/if} class="center" name="krb5KDCFlags_0" value="1" type="checkbox">initial<br>
+<input {if $krb5KDCFlags_1} checked {/if} class="center" name="krb5KDCFlags_1" value="1" type="checkbox">forwardable<br>
+<input {if $krb5KDCFlags_2} checked {/if} class="center" name="krb5KDCFlags_2" value="1" type="checkbox">proxiable<br>
+<input {if $krb5KDCFlags_3} checked {/if} class="center" name="krb5KDCFlags_3" value="1" type="checkbox">renewable<br>
+<input {if $krb5KDCFlags_4} checked {/if} class="center" name="krb5KDCFlags_4" value="1" type="checkbox">postdate<br>
+<input {if $krb5KDCFlags_5} checked {/if} class="center" name="krb5KDCFlags_5" value="1" type="checkbox">server<br>
+<input {if $krb5KDCFlags_6} checked {/if} class="center" name="krb5KDCFlags_6" value="1" type="checkbox">client<br>
+                                       </td>
+                                       <td>
+<input {if $krb5KDCFlags_7} checked {/if} class="center" name="krb5KDCFlags_7" value="1" type="checkbox">invalid<br>
+<input {if $krb5KDCFlags_8} checked {/if} class="center" name="krb5KDCFlags_8" value="1" type="checkbox">require-preauth<br>
+<input {if $krb5KDCFlags_9} checked {/if} class="center" name="krb5KDCFlags_9" value="1" type="checkbox">change-pw<br>
+<input {if $krb5KDCFlags_10} checked {/if} class="center" name="krb5KDCFlags_10" value="1" type="checkbox">require-hwauth<br>
+<input {if $krb5KDCFlags_11} checked {/if} class="center" name="krb5KDCFlags_11" value="1" type="checkbox">ok-as-delegate<br>
+<input {if $krb5KDCFlags_12} checked {/if} class="center" name="krb5KDCFlags_12" value="1" type="checkbox">user-to-user<br>
+<input {if $krb5KDCFlags_13} checked {/if} class="center" name="krb5KDCFlags_13" value="1" type="checkbox">immutable<br>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<input type="hidden" name="pwd_heimdal_posted" value="1">
+<p class="seperator"></p>
+<p style="text-align:right;">
+       <input type="submit" name="pw_save" value="{t}Save{/t}">
+       &nbsp;
+       <input type="submit" name="pw_abort" value="{t}Cancel{/t}">
+</p>
index eb48106485b0dbdfe0cd3bab57962c9a63cda4c5..9ceb018d113253364723287259835ebb218cfefe 100644 (file)
 class passwordMethodheimdal extends passwordMethod
 {
 
+  var $krb5MaxLife      = 86400;
+  var $krb5MaxRenew     = 604800;
+  var $krb5ValidStart   = 20071231000000;
+  var $krb5ValidEnd     = 20101231000000;
+  var $krb5PasswordEnd  = 20101231000000;
+
+  var $unlimited_krb5MaxLife    = FALSE;
+  var $unlimited_krb5MaxRenew   = FALSE;
+  var $unlimited_krb5ValidStart = FALSE;
+  var $unlimited_krb5ValidEnd   = FALSE;
+  var $unlimited_krb5PasswordEnd= FALSE;
+
+  var $flag_list = array(
+      "0"=>"initial" , 
+      "1"=>"forwardable" , 
+      "2"=>"proxiable" , 
+      "3"=>"renewable" , 
+      "4"=>"postdate" , 
+      "5"=>"server" , 
+      "6"=>"client" , 
+      "7"=>"invalid" , 
+      "8"=>"require-preauth" , 
+      "9"=>"change-pw" , 
+      "10"=>"require-hwauth" , 
+      "11"=>"ok-as-delegate" , 
+      "12"=>"user-to-user" , 
+      "13"=>"immutable");
+  var $krb5KDCFlags     = 123;
+
+  /* Dummy */
+  var $unlimited_krb5KDCFlags     = FALSE;
+
+  var $attributes = array("krb5MaxLife","krb5MaxRenew","krb5KDCFlags","krb5ValidStart","krb5ValidEnd","krb5PasswordEnd");
+
        function passwordMethodheimdal(&$config)  
        {
     $this->config= $config;
@@ -87,25 +121,97 @@ class passwordMethodheimdal extends passwordMethod
 
   function configure()
   {
-    #TODO
-    # * Handle POST's from and for this dialog
-    # * Return filled template for the config sub-dialog.
-    # See https://oss.gonicus.de/labs/gosa/ticket/223
+    $this->save_object();
+
+    /* Cancel heimdal options */
     if (isset($_POST['pw_abort'])){
       return "";
     }
-    return "<input type='submit' id='pw_abort' name='pw_abort' value='Abort'>";
+
+    /* Cancel heimdal options */
+    if (isset($_POST['pw_save'])){
+      $msgs = $this->check();
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          msg_dialog::display(_("Heimdal properties"),$msg,WARNING_DIALOG);
+        }
+      }else{
+        $this->save();
+        return "";
+      }
+    }
+
+    $smarty = get_smarty();
+    foreach($this->attributes as $attr){
+      $uattr = "unlimited_".$attr;
+      $smarty->assign($attr ,$this->$attr);
+      $smarty->assign($uattr,$this->$uattr);
+    }
+    foreach($this->flag_list as $key => $name){
+      $val = pow(2,$key);
+      if($this->krb5KDCFlags & $val){
+        $smarty->assign("krb5KDCFlags_".$key,TRUE);
+      }else{
+        $smarty->assign("krb5KDCFlags_".$key,FALSE);
+      }
+    }
+
+    return($smarty->fetch(get_template_path("pwd_heimdal.tpl")));
+  }
+
+  
+  function save_object()
+  {
+    if(isset($_POST['pwd_heimdal_posted'])){
+      foreach($this->attributes as $attr){
+        $uattr = "unlimited_".$attr;
+        if(isset($_POST[$uattr])){
+          $this->$uattr = TRUE;
+        }else{
+          $this->$uattr = FALSE;
+        }
+
+        if(isset($_POST[$attr])){
+          $this->$attr = get_post($attr);
+        }
+      }
+  
+      $int = "";
+      foreach($this->flag_list as $key => $name){
+        $post = "krb5KDCFlags_".$key;
+        if(isset($_POST[$post])){
+          $int |= pow(2,$key);
+        }
+      }
+      $this->krb5KDCFlags = $int;
+    }
   }
 
+  function check()
+  {
+    $message = array();
+    if(!is_numeric($this->krb5MaxLife) && !$this->unlimited_krb5MaxLife){
+      $message[] = sprintf(_("Please specify a numeric value for %s."),_("Max life"));
+    }
+    if(!is_numeric($this->krb5MaxRenew) && !$this->unlimited_krb5MaxRenew){
+      $message[] = sprintf(_("Please specify a numeric value for %s."),_("Max renew"));
+    }
+    if(!is_numeric($this->krb5ValidStart) && !$this->unlimited_krb5ValidStart){
+      $message[] = sprintf(_("Please specify a numeric value for %s."),_("Valid start"));
+    }
+    if(!is_numeric($this->krb5ValidEnd) && !$this->unlimited_krb5ValidEnd){
+      $message[] = sprintf(_("Please specify a numeric value for %s."),_("Valid end"));
+    }
+    if(!is_numeric($this->krb5PasswordEnd) && !$this->unlimited_krb5PasswordEnd){
+      $message[] = sprintf(_("Please specify a numeric value for %s."),_("Valid password"));
+    }
+    return($message);
+  }
 
   function save($dn)
   {
-    #TODO
-    # Write information to the LDAP
-    echo "Possible write changes for $dn...";
+    echo "Save, haha not realy"; 
   }
-
-  
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: