From 322ee958a3c4ff660eda187e96fe1aafa9ec7d0f Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 23 Apr 2008 13:44:18 +0000 Subject: [PATCH] Added new policy class git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10655 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/kerberos/class_goKrbServer.inc | 93 +++++++++++++------ .../services/kerberos/class_krb5_policy.inc | 58 ++++++++++++ .../systems/services/kerberos/krb5_policy.tpl | 34 +++++++ 3 files changed, 159 insertions(+), 26 deletions(-) create mode 100644 gosa-plugins/heimdal/admin/systems/services/kerberos/class_krb5_policy.inc create mode 100644 gosa-plugins/heimdal/admin/systems/services/kerberos/krb5_policy.tpl diff --git a/gosa-plugins/heimdal/admin/systems/services/kerberos/class_goKrbServer.inc b/gosa-plugins/heimdal/admin/systems/services/kerberos/class_goKrbServer.inc index 8d00fedc2..4887b9204 100644 --- a/gosa-plugins/heimdal/admin/systems/services/kerberos/class_goKrbServer.inc +++ b/gosa-plugins/heimdal/admin/systems/services/kerberos/class_goKrbServer.inc @@ -37,7 +37,7 @@ class goKrbServer extends goService{ }else{ $this->policies = array(); foreach($tmp as $policy){ - $this->policies[] = array("NAME" => $policy,"STATUS" => "LOADED"); + $this->policies[] = array("NAME" => $policy,"STATUS" => "LOADED","DATA" => array()); } } } @@ -47,11 +47,74 @@ class goKrbServer extends goService{ { $smarty = get_smarty(); - if($this->is_account && !$this->view_logged){ + if(!$this->view_logged){ $this->view_logged = TRUE; new log("view","server/".get_class($this),$this->dn); } + /******* + Display sub dialogs + *******/ + + /* Add new Policy requested + */ + if(isset($_POST['policy_add'])){ + $this->dialog = new krb5_policy($this->config,array()); + } + + + /* Walk through POSTs an check for image-button posts + */ + foreach($_POST as $name => $value){ + + /* Remove policy requested + */ + if(preg_match("/^policy_del/",$name)){ + $id = preg_replace("/^policy_del_([0-9]*)_.*/i","\\1",$name); + if(isset($this->policies[$id])){ + $this->policies[$id]['STATUS'] = "REMOVED"; + } + break; + } + + /* Edit Policy requested + */ + if(preg_match("/^policy_edit/",$name)){ + $id = preg_replace("/^policy_edit_([0-9]*)_.*/i","\\1",$name); + if(isset($this->policies[$id])){ + + /* Load policy information, if not done before + */ + if($this->policies[$id]['STATUS'] == "LOADED" && empty($this->policies[$id]['DATA'])){ + $o = new gosaSupportDaemon(); + $this->policies[$id]['DATA'] = $o->krb5_get_policy("00:01:6c:9d:aa:16",$this->policies[$id]['NAME']); + } + + /* Open dialog */ + $this->dialog = new krb5_policy($this->config,$this->policies[$id]); + } + break; + } + } + + + if(isset($_POST['cancel_policy'])){ + $this->dialog = NULL; + } + if(isset($_POST['save_policy'])){ + $this->dialog->save_object(); + echo "NYI"; + $this->dialog = NULL; + } + if($this->dialog instanceof krb5_policy){ + $this->dialog->save_object(); + return($this->dialog->execute()); + } + + /******* + Create HTML output for this plugin + *******/ + $tmp = $this->plinfo(); foreach($tmp['plProvidedAcls'] as $name => $translation){ $smarty->assign($name."ACL",$this->getacl($name)); @@ -101,32 +164,10 @@ class goKrbServer extends goService{ if(isset($_POST['goKrbServerPosted'])){ plugin::save_object(); } - - /* */ - if(isset($_POST['policy_add'])){ - echo "add"; - // $this->dialog = new krb5_policy($this->config,array()); - } - foreach($_POST as $name => $value){ - if(preg_match("/^policy_del/",$name)){ - $id = preg_replace("/^policy_del_([0-9]*)_.*/i","\\1",$name); - if(isset($this->policies[$id])){ - unset($this->policies[$id]); - } - break; - } - if(preg_match("/^policy_edit/",$name)){ - $id = preg_replace("/^policy_edit_([0-9]*)_.*/i","\\1",$name); - if(isset($this->policies[$id])){ - echo "edit $id"; - // $this->dialog = new krb5_policy($this->config,$this->policies[$id]); - } - break; - } - } } - /* Return plugin informations for acl handling */ + + /* Return plugin informations for acl handling */ static function plInfo() { return (array( diff --git a/gosa-plugins/heimdal/admin/systems/services/kerberos/class_krb5_policy.inc b/gosa-plugins/heimdal/admin/systems/services/kerberos/class_krb5_policy.inc new file mode 100644 index 000000000..6f993e846 --- /dev/null +++ b/gosa-plugins/heimdal/admin/systems/services/kerberos/class_krb5_policy.inc @@ -0,0 +1,58 @@ +config = $config; + if(count($entry)){ + $this->is_new =FALSE; + $this->name = $entry['NAME']; + $this->data = $entry['DATA']; + } + $this->init_name = $this->name; + } + + public function execute() + { + $display = plugin::execute(); + $smarty = get_smarty(); + + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->data[$attr]); + } + return($smarty->fetch(get_template_path("krb5_policy.tpl",TRUE,dirname(__FILE__)))); + } + + + public function save_object() + { + if(isset($_POST['Policy_Posted'])){ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->data[$attr] = get_post($attr); + } + } + } + } + + + public function save() + { + $ret = array(); + $ret['INITIAL_NAME']= $this->init_name; + $ret['NAME'] = $this->name; + $ret['DATA'] = $this->data; + return($ret); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/heimdal/admin/systems/services/kerberos/krb5_policy.tpl b/gosa-plugins/heimdal/admin/systems/services/kerberos/krb5_policy.tpl new file mode 100644 index 000000000..d52853293 --- /dev/null +++ b/gosa-plugins/heimdal/admin/systems/services/kerberos/krb5_policy.tpl @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
{t}Mask{/t}
{t}POLICY_REFCNT{/t}
{t}PW_HISTORY_NUM{/t}
{t}PW_MAX_LIFE{/t}
{t}PW_MIN_CLASSES{/t}
{t}PW_MIN_LIFE{/t}
+ +

 

+ +
+ +   + +
-- 2.30.2