Code

Updated policy stuff for heimdal
[gosa.git] / gosa-plugins / heimdal / admin / systems / services / kerberos / class_krb5_policy.inc
1 <?php
4 class krb5_policy extends plugin
5 {
6   var $name   = "";
7   var $data   = array();
8   var $is_new = TRUE;
9   var $init_name ="";
10   var $parent ;
11   var $config ;
12   var $attributes = array("MASK","POLICY_REFCNT","PW_HISTORY_NUM","PW_MAX_LIFE",
13       "PW_MIN_CLASSES","PW_MIN_LENGTH","PW_MIN_LIFE");
15         public function __construct($config,$entry,$parent)
16         {
17     $this->config = $config;
18     $this->parent = $parent;
19     if(count($entry)){
20       $this->is_new =FALSE;
21       $this->name = $entry['NAME'];
22       $this->data = $entry['DATA'];
23     }
24     $this->init_name = $this->name;
25         }
27   public function execute()
28   {
29     $display = plugin::execute();
30     $smarty = get_smarty();    
32     $smarty->assign("name",$this->name);
33     foreach($this->attributes as $attr){
34       $smarty->assign($attr,$this->data[$attr]);
35     }
36     return($smarty->fetch(get_template_path("krb5_policy.tpl",TRUE,dirname(__FILE__))));
37   }
40   public function save_object()
41   {
42     if(isset($_POST['Policy_Posted'])){
43       if(isset($_POST['name'])){
44         $this->name = get_post("name");
45       }
46       foreach($this->attributes as $attr){
47         if(isset($_POST[$attr])){
48           $this->data[$attr] = get_post($attr);
49         }
50       }
51     }
52   }
53    
54   
55   public function check()
56   {
57     $messages = array();
58     $names = $this->parent->getPolicyNames();
59     if($this->name != $this->init_name && in_array($this->name,$names)){
60       $messages[] = msgPool::duplicated(_("Name"));
61     }
62     return($messages);
63   }
64    
66   public function save()
67   {
68     $ret = array();
69     $ret['NAME']        = $this->name;
70     $ret['DATA']        = $this->data;
71     return($ret);
72   }
73 }
75 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
76 ?>