From ded00cc8756034894b097ab4d98443780daff953 Mon Sep 17 00:00:00 2001 From: zeph Date: Tue, 25 Mar 2008 17:04:36 +0000 Subject: [PATCH] sudo roles listing git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5-plugins@9979 594d385d-05f5-0310-b6e9-bd551577e9d8 --- sudo-ldap/src/class_sudoldap.inc | 38 ++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/sudo-ldap/src/class_sudoldap.inc b/sudo-ldap/src/class_sudoldap.inc index 8629e73f3..10b59b4fc 100644 --- a/sudo-ldap/src/class_sudoldap.inc +++ b/sudo-ldap/src/class_sudoldap.inc @@ -28,6 +28,8 @@ class sudoldap extends plugin "sudoOption"); var $objectclasses = array("sudoRole"); + + var $roles_list = array(); /* constructor, if 'dn' is set, the node loads the given 'dn' from LDAP */ @@ -101,18 +103,17 @@ class sudoldap extends plugin $RoleList -> SetHeight(300); $editImg = " "; - /* - foreach($this->Zones as $zone => $values ){ + $this->roles_list = $this->get_list_of_roles(); + foreach($this->roles_list as $role => $values ){ $link = "%s"; - $ZoneList->AddEntry(array( - array("string" => sprintf($link,base64_encode($zone),getNameFromMix($zone))), - array("string" => sprintf($link,base64_encode($zone),_("Reverse zone")." : ".getNameFromMix($values['ReverseZone']))), - array("string" => _("TTL")." : ".$values['sOAttl']), - array("string" => _("Class")." : ".$values['dNSClass']), - array("string" => str_replace("%s",base64_encode($zone),$editImg)) + $RoleList->AddEntry(array( + array("string" => sprintf($link,base64_encode($role),$role)), + //array("string" => sprintf($link,base64_encode($zone),_("Reverse zone")." : ".getNameFromMix($values['ReverseZone']))), + //array("string" => _("TTL")." : ".$values['sOAttl']), + //array("string" => _("Class")." : ".$values['dNSClass']), + array("string" => str_replace("%s",base64_encode($role),$editImg)) )); } - */ $smarty->assign("sudoldapACL",chkacl($this->acl,"sudoldap")); @@ -121,6 +122,25 @@ class sudoldap extends plugin return($display); } + function get_list_of_roles() + { + $ret = array(); + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(objectClass=sudoRole)",array("cn","description")); + while ($attrs= $ldap->fetch()){ + $cn= $attrs['cn'][0]; + if (isset($attrs['description'])){ + $description= " - ".$attrs['description'][0]; + } else { + $description= ""; + } + $ret[$cn]= "$description"; + } + return($ret); + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -- 2.30.2