From 20324163e93b1659b553c67df40cd0abb4ee48c3 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Fri, 21 Mar 2003 10:07:49 +0000 Subject: [PATCH] listhosts: free search result listgroups: initial checkin --- lam/lib/listgroups.php | 61 ++++++++++++++++++++++++++++++++++++++++++ lam/lib/listhosts.php | 4 +-- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 lam/lib/listgroups.php diff --git a/lam/lib/listgroups.php b/lam/lib/listgroups.php new file mode 100644 index 00000000..9b4dc07e --- /dev/null +++ b/lam/lib/listgroups.php @@ -0,0 +1,61 @@ +"; + +// Samba hosts have the attribute "sambaAccount" and end with "$" +$filter = "(objectClass=posixGroup)"; +$attrs = array("cn", "gidNumber", "memberUID", "description"); +$sr = ldap_search($_SESSION["ldap"]->server(), + $_SESSION["config"]->get_GroupSuffix(), + $filter, $attrs); +$info = ldap_get_entries($_SESSION["ldap"]->server, $sr); +ldap_free_result($sr); + +// print host table header +echo "\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +// print host list +for ($i = 0; $i < sizeof($info)-1; $i++) { // ignore last entry in array which is "count" + echo(""); + echo (""); + echo (""); + // create list of group members + array_shift($info[$i]["memberuid"]); // delete count entry + $grouplist = implode("; ", $info[$i]["memberuid"]); + echo (""); + echo (""); + echo(""); +} +echo ("
" . _("Grup Name") . "" . _("GID Number") . "" . _("Group Members") . "" . _("Description") . "
" . $info[$i]["cn"][0] . "" . $info[$i]["gidnumber"][0] . "" . $grouplist . "" . $info[$i]["description"][0] . "
"); +?> diff --git a/lam/lib/listhosts.php b/lam/lib/listhosts.php index a8b38d75..7dbcefcc 100644 --- a/lam/lib/listhosts.php +++ b/lam/lib/listhosts.php @@ -35,7 +35,7 @@ $sr = ldap_search($_SESSION["ldap"]->server(), $_SESSION["config"]->get_HostSuffix(), $filter, $attrs); $info = ldap_get_entries($_SESSION["ldap"]->server, $sr); -//ldap_free_result($sr); +ldap_free_result($sr); // print host table echo "\n"; @@ -51,4 +51,4 @@ for ($i = 0; $i < sizeof($info)-1; $i++) { // ignore last entry in array which i echo(""); } echo ("
"); -?> \ No newline at end of file +?>