Code

Added a few krb5 functions
[gosa.git] / gosa-plugins / heimdal / admin / systems / services / kerberos / class_goKrbServer.inc
1 <?php
3 class goKrbServer extends goService{
4         
5   var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports NTP service.";
6   var $cli_description  = "Some longer text\nfor help";
7   var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9   /* This plugin only writes its objectClass */
10   var $objectclasses    = array("goKrbServer");
11   var $attributes       = array("goKrbRealm");
12   var $StatusFlag       = "goKrbServerStatus";
13  
14   /* This class can't be assigned twice so it conflicts with itsself */
15   var $conflicts        = array("goKrbServer");
17   var $DisplayName      = "";
18   var $dn               = NULL;
19   var $goKrbServerStatus= "";
20   var $cn               = "";
21   var $goKrbRealm       = "";
22   var $view_logged      = FALSE;
24   var $policies         = array();
25  
26   function goKrbServer(&$config,$dn)
27   {
28     goService::goService($config,$dn);
29     $this->DisplayName = _("Kerberos service");
30   }
33   function execute()
34   { 
35     $smarty = get_smarty(); 
37     if($this->is_account && !$this->view_logged){
38       $this->view_logged = TRUE;
39       new log("view","server/".get_class($this),$this->dn);
40     }
42     $tmp = $this->plinfo();
43     foreach($tmp['plProvidedAcls'] as $name => $translation){
44       $smarty->assign($name."ACL",$this->getacl($name));
45     }
47     foreach($this->attributes as $attr){
48       $smarty->assign($attr,$this->$attr);
49     }
51     $o = new gosaSupportDaemon();
52     $this->policies = $o->krb5_list_policies("00:01:6c:9d:aa:16");
54     $divlist = new divSelectBox("Kerberos Policies");
55     $action  = "<input type='image' src='images/lists/edit.png' class='center' name='policy_edit_%id'>";
56     $action .= "<input type='image' src='images/lists/trash.png' class='center' name='policy_del_%id'>";
57     foreach($this->policies as $key => $policy){
58       $actions = preg_replace("/%id/",$key,$action);
59       $field1 = array("string" => $policy['POLICY']);
60       $field2 = array("string" => "Fasel bla ");
61       $field3 = array("string" => $actions, 
62                       "attach"=>"style='width:40px; text-align:right; border:0px;'");
64       $divlist->AddEntry(array($field1,$field2,$field3));
65     }
67     $smarty->assign("divlist",$divlist->DrawList());
68     return($smarty->fetch(get_template_path("goKrbServer.tpl",TRUE,dirname(__FILE__))));
69   }
72   function getListEntry()
73   {
74     $fields               = goService::getListEntry();
75     $fields['Message']    = _("Kerberos service (kadmin access informations)");
76     $fields['AllowEdit']  = true;
77     return($fields);
78   }
80   function check()
81   { 
82     $message = plugin::check();
83     if (empty($this->goKrbRealm)){
84       $message[]= msgPool::required(_("Realm"));
85     }
86     return($message);
87   }
88   
90   function save_object()
91   {
92     if(isset($_POST['goKrbServerPosted'])){
93       plugin::save_object();
94     }
96     /* */
97     if(isset($_POST['policy_add'])){
98       echo "add";
99       // $this->dialog = new krb5_policy($this->config,array());
100     }
101     foreach($_POST as $name => $value){
102       if(preg_match("/^policy_del/",$name)){
103         $id = preg_replace("/^policy_del_([0-9]*)_.*/i","\\1",$name);
104         if(isset($this->policies[$id])){
105           unset($this->policies[$id]);
106         }
107         break;
108       }
109       if(preg_match("/^policy_edit/",$name)){
110         $id = preg_replace("/^policy_edit_([0-9]*)_.*/i","\\1",$name);
111         if(isset($this->policies[$id])){
112           echo "edit $id";
113         // $this->dialog = new krb5_policy($this->config,$this->policies[$id]);
114         }
115         break;
116       }
117     }
118   } 
120     /* Return plugin informations for acl handling */
121   static function plInfo()
122   {
123     return (array(
124           "plShortName"   => _("Kerberos"),
125           "plDescription" => _("Kerberos access information")." ("._("Services").")",
126           "plSelfModify"  => FALSE,
127           "plDepends"     => array(),
128           "plPriority"    => 95,
129           "plSection"     => array("administration"),
130           "plCategory"    => array("server"),
132           "plProvidedAcls"=> array(
133             "goKrbPolicy"   => _("Policies"),
134             "goKrbRealm"    => _("Realm")) 
135           ));
136   }
138 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
139 ?>