From: hickert Date: Mon, 3 Dec 2007 11:56:13 +0000 (+0000) Subject: Upadted heimdal tpl. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9f1c5980ccc9eff992f5f0794a3bec4a6681772a;p=gosa.git Upadted heimdal tpl. Not finished yet git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7979 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/ihtml/themes/default/pwd_heimdal.tpl b/ihtml/themes/default/pwd_heimdal.tpl new file mode 100644 index 000000000..006decaec --- /dev/null +++ b/ihtml/themes/default/pwd_heimdal.tpl @@ -0,0 +1,97 @@ + + + + + + +
+

{t}Heimdal options{/t}

+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+
+

Flags

+ + + + + +
+initial
+forwardable
+proxiable
+renewable
+postdate
+server
+client
+
+invalid
+require-preauth
+change-pw
+require-hwauth
+ok-as-delegate
+user-to-user
+immutable
+
+
+ +

+

+ +   + +

diff --git a/include/class_password-methods-heimdal.inc b/include/class_password-methods-heimdal.inc index eb4810648..9ceb018d1 100644 --- a/include/class_password-methods-heimdal.inc +++ b/include/class_password-methods-heimdal.inc @@ -22,6 +22,40 @@ 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 ""; + + /* 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: