session_start();
// Author: Jon Belanger
// Date: Nov. 2004
// comments: linked to in display_users.php and edit_users.php
// start the session
include ("functions.php");
include("gui.php");
// check if the session username or seclevel are not set
// this would occur if the user was trying to get here without logging in
if (! $_SESSION['username'] | ! $_SESSION['seclevel']) {
redirect("logout.php");
exit(1);
}
// only admins can manage groups
if ($_SESSION['seclevel']!="admin") {
redirect("logout.php");
exit(1);
}
// send HTML meta and ui headers to the browser
?>
echo $_SESSION['version']. " - Manage Groups"; ?>
display_header("Manage Groups");
?>
Main - Manage Groups
|
if ($_GET['error']) {
echo "** ";
echo $_GET['error'];
} else {
echo " ";
}
?>
|
// connect to ldap to get list of groups
$ds=connect_to_ldap($_SESSION['server'], $_SESSION['port'], $_SESSION['ssl'],3);
// if the connection is successful
if ($ds) {
// bind to ldap server anonymously
$br=ldap_bind($ds);
}
?>
Add a New Group:
'*' denotes a required attribute
// get a list of all groups and group attribute values
$sr=ldap_search($ds,$_SESSION['groupbase'], "(&(gidNumber=*)(objectClass=posixGroup))");
$info=ldap_get_entries($ds,$sr);
// display each group in the browser
for ($i=0;$i<$info["count"];$i++) {
echo "";
echo "".$info[$i]["cn"][0]." | ";
echo "".$info[$i]["displayname"][0]." | ";
echo "delete group";
echo " | list group members | ";
echo "
";
}
?>
// close the ldap server connection
ldap_close($ds); ?>