Code

bdbd9a1c98fc85c16ec3de40863505547416ca90
[gosa.git] / sudo-ldap / src / class_sudoLdap.inc
1 <?php
2 /*!
3   \brief   sudoLdap plugin
4   \author  Guido Serra <gserra@guidoserra.it>
5   \version 1.00
6   \date    22.03.2008
8   This class provides the functionality to read and write all attributes
9   relevant for sudo-ldap from/to the LDAP.
10  */
12 class sudoLdap extends plugin
13 {
14   /* Definitions */
15   var $plHeadline= "sudo-ldap";
16   var $plDescription= "This does something";
18   /* Plugin specific values */
19  
20   var $attributes     = array(  "sudoUser", 
21                                 "sudoHost", 
22                                 "sudoCommand", 
23                                 "sudoRunAs", 
24                                 "sudoOption");
25   
26   var $objectclasses  = array("sudoRole");
27   
28   /* constructor, if 'dn' is set, the node loads the given
29      'dn' from LDAP */
30   function sudoLdap ($config, $dn= NULL, $parent= NULL)
31   {
32     /* Configuration is fine, allways */
33     $this->config= $config;
35     /* Load bases attributes */
36     plugin::plugin($config, $dn, $parent);
38     $ldap= $this->config->get_ldap_link();
39     
40   }
43   /* execute generates the html output for this node */
44   function execute($isCopyPaste = false)
45   {
46         /* Call parent execute */
47         plugin::execute();
48         $display= "";
49         $smarty= get_smarty();
51         $RoleList = new divSelectBox("sudoRoles");
52         $RoleList -> SetHeight(300);
53         $editImg = "<input type='image' src='images/edit.png' name='editZone_%s'>
54         <input type='image' src='images/edittrash.png' name='delZone_%s'>";
55         /*
56         foreach($this->Zones as $zone => $values ){
57                 $link = "<a href='?plug=".$_GET['plug']."&act=edit&id=%s'>%s</a>";
58                 $ZoneList->AddEntry(array(
59                         array("string" => sprintf($link,base64_encode($zone),getNameFromMix($zone))),
60                         array("string" => sprintf($link,base64_encode($zone),_("Reverse zone")." : ".getNameFromMix($values['ReverseZone']))),
61                         array("string" => _("TTL")." : ".$values['sOAttl']),
62                         array("string" => _("Class")." : ".$values['dNSClass']),
63                         array("string" => str_replace("%s",base64_encode($zone),$editImg))
64             ));
65         }    
66         */
68         $smarty->assign("sudoldapACL",chkacl($this->acl,"sudoldap"));
70         $smarty->assign("RoleList",$RoleList->DrawList());
71         $display.= $smarty->fetch(get_template_path('sudoldap.tpl', TRUE));
72         return($display);
73   }
75 }
77 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
78 ?>