1 <?php
2 /*!
3 \brief sudo-ldap 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 */
20 var $dialog = NULL;
22 var $attributes = array("sudoUser",
23 "sudoHost",
24 "sudoCommand",
25 "sudoRunAs",
26 "sudoOption");
28 var $objectclasses = array("sudoRole");
30 /* constructor, if 'dn' is set, the node loads the given
31 'dn' from LDAP */
32 function sudoldap ($config, $dn= NULL, $parent= NULL)
33 {
34 /* Configuration is fine, allways */
35 $this->config= $config;
37 /* Load bases attributes */
38 plugin::plugin($config, $dn, $parent);
40 $ldap= $this->config->get_ldap_link();
42 }
45 /* execute generates the html output for this node */
46 function execute($isCopyPaste = false)
47 {
48 /* Call parent execute */
49 plugin::execute();
50 $display= "";
51 $smarty= get_smarty();
53 /* Add empty new zone
54 */
55 if(isset($_POST['AddRole']) && chkacl($this->acl,"sudoldap") == ""){
56 $this->dialog = new sudoldapEditRole($this->config,$this->dn);
57 }
59 /* Show dialog
60 */
61 if($this->dialog!= NULL){
62 $this->dialog->save_object();
63 $this->dialog->parent = $this;
64 return($this->dialog->execute());
65 }
67 $RoleList = new divSelectBox("sudoRoles");
68 $RoleList -> SetHeight(300);
69 $editImg = "<input type='image' src='images/edit.png' name='editZone_%s'>
70 <input type='image' src='images/edittrash.png' name='delZone_%s'>";
71 /*
72 foreach($this->Zones as $zone => $values ){
73 $link = "<a href='?plug=".$_GET['plug']."&act=edit&id=%s'>%s</a>";
74 $ZoneList->AddEntry(array(
75 array("string" => sprintf($link,base64_encode($zone),getNameFromMix($zone))),
76 array("string" => sprintf($link,base64_encode($zone),_("Reverse zone")." : ".getNameFromMix($values['ReverseZone']))),
77 array("string" => _("TTL")." : ".$values['sOAttl']),
78 array("string" => _("Class")." : ".$values['dNSClass']),
79 array("string" => str_replace("%s",base64_encode($zone),$editImg))
80 ));
81 }
82 */
84 $smarty->assign("sudoldapACL",chkacl($this->acl,"sudoldap"));
86 $smarty->assign("RoleList",$RoleList->DrawList());
87 $display.= $smarty->fetch(get_template_path('sudoldap.tpl', TRUE));
88 return($display);
89 }
91 }
93 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
94 ?>