diff --git a/lam/lib/listusers.php b/lam/lib/listusers.php index 8c64e4aa..8a961a13 100644 --- a/lam/lib/listusers.php +++ b/lam/lib/listusers.php @@ -25,6 +25,10 @@ $Id$ include_once ('../config/config.php'); include_once("ldap.php"); +// start session +session_save_path("../sess"); +@session_start(); + // class representing local user entry with attributes of ldap user entry include_once("userentry.php"); @@ -34,47 +38,73 @@ echo " echo ""; echo ""; echo "
"; -// config object should be in session!!! -$config = new Config(); -$ldap = new Ldap($config); -// username/password should also be in session!!! -$username = "cn=admin,o=test,c=de"; -$passwd = "secret"; -$result = $ldap->connect ($username, $passwd); +// generate attribute-description table +$attr_array; // list of LDAP attributes to show +$desc_array; // list of descriptions for the attributes +$attr_string = $_SESSION["config"]->get_userlistAttributes(); +$temp_array = explode(";", $attr_string); +$hash_table = $_SESSION["ldap"]->attributeUserArray(); +for ($i = 0; $i < sizeof($temp_array); $i++) { +// if value is predifined, look up description in hash_table +if (substr($temp_array[$i],0,1) == "#") { + $attr = substr($temp_array[$i],1); + $attr_array[$i] = $attr; + $desc_array[] = $hash_table[$attr]; +} +// if not predefined, the attribute is seperated by a ":" from description +else { + $attr = explode(":", $temp_array[$i]); + $attr_array[$i] = $attr[0]; + $desc_array[$i] = $attr[1]; +} +} -$user_dn_list = $ldap->getUsers ($config->get_UserSuffix()); +$user_dn_list = $_SESSION["ldap"]->getUsers + ($_SESSION["config"]->get_UserSuffix()); + +echo ("\n"); + echo ""; - -$ldap->close(); - +echo "