More work on creating the functions for the LDAP admin section

This commit is contained in:
jengo 2000-10-20 05:59:25 +00:00
parent 0295005a6e
commit 689f013abc
6 changed files with 36 additions and 10 deletions

View File

@ -86,4 +86,6 @@
$t->pparse("out","footer"); $t->pparse("out","footer");
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
account_close();
?> ?>

View File

@ -62,4 +62,5 @@
Header("Location: " . $phpgw->link("accounts.php","cd=$cd")); Header("Location: " . $phpgw->link("accounts.php","cd=$cd"));
} }
account_close();
?> ?>

View File

@ -227,5 +227,6 @@
</center> </center>
</form> </form>
<?php <?php
account_close();
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -14,6 +14,15 @@
// Sections of code where taking from slapda http://www.jeremias.net/projects/sldapa by // Sections of code where taking from slapda http://www.jeremias.net/projects/sldapa by
// Jason Jeremias <jason@jeremias.net> // Jason Jeremias <jason@jeremias.net>
$ldap = ldap_connect($phpgw_info["server"]["ldap_host"]);
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>";
exit;
}
function account_read($method,$start,$sort,$order) function account_read($method,$start,$sort,$order)
{ {
@ -21,7 +30,7 @@
function account_add($account_info) function account_add($account_info)
{ {
global $phpgw_info; global $phpgw_info, $ldap;
if ($phpgw_info["server"]["ldap_encryption_type"] == "DES") { if ($phpgw_info["server"]["ldap_encryption_type"] == "DES") {
$salt = randomstring(2); $salt = randomstring(2);
@ -33,13 +42,6 @@
$userpassword = md5cryptpass($account_info["passwd"], $salt); $userpassword = md5cryptpass($account_info["passwd"], $salt);
} }
$ldap = ldap_connect($phpgw_info["server"]["ldap_host"]);
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>";
exit;
}
// Create our entry // Create our entry
$entry["uid"] = $uid; $entry["uid"] = $uid;
$entry["uidNumber"] = $uidnumber; $entry["uidNumber"] = $uidnumber;
@ -92,10 +94,22 @@
function account_delete($account_id) function account_delete($account_id)
{ {
global $ldap;
$searchline = getSearchLine($searchstring);
$result = ldap_search($ldap, $BASEDN, $searchline);
$entry = ldap_get_entries($ldap, $result);
$numentries = $entry["count"];
@ldap_delete($ldap, $button);
} }
function account_exsists($loginid) function account_exsists($loginid)
{ {
} }
function account_close()
{
@ldap_close($ldap);
}

View File

@ -243,3 +243,9 @@
return $phpgw->db->f(0); return $phpgw->db->f(0);
} }
// This is need for LDAP, so this is a dummy function.
function account_close()
{
return True;
}

View File

@ -138,5 +138,7 @@
$t->set_var("lang_button",Lang("Add")); $t->set_var("lang_button",Lang("Add"));
$t->pparse("out","form"); $t->pparse("out","form");
account_close();
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>