mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-13 17:38:19 +01:00
LDAP list users is now working
This commit is contained in:
parent
703b1c2553
commit
9b9bad78f0
@ -46,7 +46,6 @@
|
|||||||
$account_info = account_read($method,$start,$sort,$order);
|
$account_info = account_read($method,$start,$sort,$order);
|
||||||
|
|
||||||
while (list($null,$account) = each($account_info)) {
|
while (list($null,$account) = each($account_info)) {
|
||||||
echo "<br>" . $account[1];
|
|
||||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||||
$t->set_var("tr_color",$tr_color);
|
$t->set_var("tr_color",$tr_color);
|
||||||
|
|
||||||
@ -71,10 +70,10 @@
|
|||||||
$t->set_var("row_view",'<a href="' . $phpgw->link("viewaccount.php", "account_id="
|
$t->set_var("row_view",'<a href="' . $phpgw->link("viewaccount.php", "account_id="
|
||||||
. $account["account_id"]) . '"> ' . lang("View") . ' </a>');
|
. $account["account_id"]) . '"> ' . lang("View") . ' </a>');
|
||||||
|
|
||||||
if ($phpgw->db->num_rows() == 1) {
|
if ($total == 1) {
|
||||||
$t->set_var("output","");
|
$t->set_var("output","");
|
||||||
}
|
}
|
||||||
if ($phpgw->db->num_rows() != ++$i) {
|
if ($total != ++$i) {
|
||||||
$t->parse("output","row",True);
|
$t->parse("output","row",True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,21 @@
|
|||||||
|
|
||||||
$ldap = ldap_connect($phpgw_info["server"]["ldap_host"]);
|
$ldap = ldap_connect($phpgw_info["server"]["ldap_host"]);
|
||||||
|
|
||||||
if (! ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) {
|
if (! @ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) {
|
||||||
echo "<p><b>Error binding to LDAP server. Check your config</b>";
|
echo "<p><b>Error binding to LDAP server. Check your config</b>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSearchLine($searchstring)
|
||||||
|
{
|
||||||
|
if (($searchstring=="*") || ($searchstring=="")) {
|
||||||
|
$searchline = "cn=*";
|
||||||
|
} else {
|
||||||
|
$searchline = sprintf("cn=*%s*",$searchstring);
|
||||||
|
}
|
||||||
|
return $searchline;
|
||||||
|
}
|
||||||
|
|
||||||
function descryptpass($userpass, $random)
|
function descryptpass($userpass, $random)
|
||||||
{
|
{
|
||||||
$lcrypt = "{crypt}";
|
$lcrypt = "{crypt}";
|
||||||
@ -41,10 +51,34 @@
|
|||||||
|
|
||||||
return $ldappassword;
|
return $ldappassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not the best method, but it works for now.
|
||||||
|
function account_total()
|
||||||
|
{
|
||||||
|
global $phpgw_info, $ldap;
|
||||||
|
|
||||||
|
$filter = "(|(uid=*))";
|
||||||
|
$sr = ldap_search($ldap,$phpgw_info["server"]["ldap_context"],$filter,array("sn","givenname","uid"));
|
||||||
|
$info = ldap_get_entries($ldap, $sr);
|
||||||
|
|
||||||
|
return count($info);
|
||||||
|
}
|
||||||
|
|
||||||
function account_read($method,$start,$sort,$order)
|
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"));
|
||||||
|
$info = ldap_get_entries($ldap, $sr);
|
||||||
|
|
||||||
|
for ($i=0; $i<count($info); $i++) {
|
||||||
|
$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];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $account_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
function account_add($account_info)
|
function account_add($account_info)
|
||||||
|
Loading…
Reference in New Issue
Block a user