-userlist fixed

-4 attributes displayed
This commit is contained in:
dechutes 2003-03-17 23:24:35 +00:00
parent f49efa989f
commit 1f5a75333e
1 changed files with 31 additions and 17 deletions

View File

@ -13,7 +13,7 @@ $Id$
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more detaexils.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
@ -25,31 +25,45 @@ $Id$
include_once ('../config/config.php'); include_once ('../config/config.php');
include_once("ldap.php"); include_once("ldap.php");
$ldapconnection = new Ldap(new Config()); // class representing local user entry with attributes of ldap user entry
$userlist = $ldapconnection->getUsers(); include_once("userentry.php");
//$bla = array (attr1, attr2); echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\" />";
//$userlist = array ($bla, $bla, $bla, $bla);
echo "<table>\n"; // 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);
$user_dn_list = $ldap->getUsers ($config->get_UserSuffix());
echo "<table width=\"100%\">\n";
// print attribute headers // print attribute headers
echo "<tr>\n"; echo "<tr>";
foreach ($userlist[0] as $attributes) { echo "<th class=\"userlist\">Vorname</th>";
echo ("<td>" . $attributes["dn"] . "</td>"); echo "<th class=\"userlist\">Nachname</th>";
} echo "<th class=\"userlist\">Uid</th>";
echo "</tr>\n"; echo "<th class=\"userlist\">Home Verzeichnis</th>";
echo "</tr>";
// print user list foreach ($user_dn_list as $user_dn) {
foreach ($userlist as $user_attributes) {
echo "<tr>\n"; echo "<tr>\n";
foreach ($user_attributes as $attribute) {
echo "<td>$attribute</td>\n"; $userentry = $ldap->getUser ($user_dn);
} echo ("<td class=\"userlist\">" . $userentry->getGivenName() . "</td>");
echo ("<td class=\"userlist\">" . $userentry->getSn() . "</td>");
echo ("<td class=\"userlist\">" . $userentry->getUid() . "</td>");
echo ("<td class=\"userlist\">" . $userentry->gethomeDirectory() . "</td>");
echo "</tr>\n"; echo "</tr>\n";
} }
echo "</table>\n"; echo "</table>";
$ldap->close();
?> ?>