more work on LDAP

This commit is contained in:
jengo 2000-10-23 05:44:39 +00:00
parent 3618a61f1c
commit 2f3d14486b
2 changed files with 32 additions and 7 deletions

View File

@ -58,22 +58,39 @@
global $phpgw_info, $ldap;
$filter = "(|(uid=*))";
$sr = ldap_search($ldap,$phpgw_info["server"]["ldap_context"],$filter,array("sn","givenname","uid"));
$sr = ldap_search($ldap,$phpgw_info["server"]["ldap_context"],$filter,array("uid"));
$info = ldap_get_entries($ldap, $sr);
return count($info);
}
function account_view($loginid)
{
global $phpgw_info, $ldap;
$filter = "(|(uid=$loginid))";
$sr = ldap_search($ldap,$phpgw_info["server"]["ldap_context"],$filter,array("sn","givenname","uid","uidnumber"));
$aci = ldap_get_entries($ldap, $sr);
$account_info["account_id"] = $aci[0]["uid"][0];
$account_info["account_lid"] = $aci[0]["uidnumber"][0];
$account_info["account_lastname"] = $aci[0]["sn"][0];
$account_info["account_firstname"] = $aci[0]["givenname"][0];
return $account_info;
}
function account_read($method,$start,$sort,$order)
{
global $phpgw_info, $ldap;
$filter = "(|(uid=*))";
$sr = ldap_search($ldap,$phpgw_info["server"]["ldap_context"],$filter,array("sn","givenname","uid"));
$sr = ldap_search($ldap,$phpgw_info["server"]["ldap_context"],$filter,array("sn","givenname","uid","uidnumber"));
$info = ldap_get_entries($ldap, $sr);
for ($i=0; $i<count($info); $i++) {
if (! $phpgw_info["server"]["global_denied_users"][$info[$i]["uid"][0]]) {
$account_info[$i]["account_id"] = $info[$i]["uidnumber"][0];
$account_info[$i]["account_lid"] = $info[$i]["uid"][0];
$account_info[$i]["account_firstname"] = $info[$i]["givenname"][0];
$account_info[$i]["account_lastname"] = $info[$i]["sn"][0];

View File

@ -18,19 +18,27 @@
$phpgw_info["flags"]["currentapp"] = "admin";
include("../header.inc.php");
include($phpgw_info["server"]["server_root"] . "/admin/inc/accounts_"
. $phpgw_info["server"]["auth_type"] . ".inc.php");
if (! $account_id) {
Header("Location: " . $phpgw->link("accounts.php"));
}
$phpgw->db->query("select account_lid from accounts where account_id='$account_id'");
$phpgw->db->next_record();
$db_perms = $phpgw->accounts->read_apps($phpgw->db->f("account_lid"));
$loginid = $phpgw->db->f("account_lid");
$phpgw->db->query("select * from accounts where account_id='$account_id'");
$db_perms = $phpgw->accounts->read_apps($loginid);
$account_info = account_view($loginid);
$phpgw->db->query("select account_lastlogin,account_lastloginfrom,account_status from accounts "
. "where account_id='$account_id'");
$phpgw->db->next_record();
$account_lastlogin = $phpgw->db->f("account_lastlogin");
$account_lastloginfrom = $phpgw->db->f("account_lastloginfrom");
$account_status = $phpgw->db->f("account_status");
?>
<center>
@ -42,17 +50,17 @@
<tr bgcolor="<?php echo $phpgw_info["theme"]["row_on"]; ?>">
<td width="40%"><?php echo lang("LoginID"); ?></td>
<td width="60%"><?php echo $phpgw->db->f("account_lid"); ?></td>
<td width="60%"><?php echo $loginid; ?></td>
</tr>
<tr bgcolor="<?php echo $phpgw_info["theme"]["row_off"]; ?>">
<td width="40%"><?php echo lang("First Name"); ?></td>
<td width="60%"><?php echo $phpgw->db->f("account_firstname"); ?>&nbsp;</td>
<td width="60%"><?php echo $account_info["account_firstname"]; ?>&nbsp;</td>
</tr>
<tr bgcolor="<?php echo $phpgw_info["theme"]["row_on"]; ?>">
<td width="40%"><?php echo lang("Last Name"); ?></td>
<td width="60%"><?php echo $phpgw->db->f("account_lastname"); ?>&nbsp;</td>
<td width="60%"><?php echo $account_info["account_lastname"]; ?>&nbsp;</td>
</tr>
<tr bgcolor="<?php echo $phpgw_info["theme"]["row_off"]; ?>">