mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-13 17:38:19 +01:00
Edit LDAP users is now working properly
This commit is contained in:
parent
5af7825a1c
commit
9adf13dc8c
@ -54,7 +54,7 @@
|
||||
if (! $totalerrors) {
|
||||
$cd = account_edit(array("loginid" => $n_loginid, "permissions" => $new_permissions,
|
||||
"firstname" => $n_firstname, "lastname" => $n_lastname,
|
||||
"passwd" => $n_passwd, "account_status" => $account_status,
|
||||
"passwd" => $n_passwd, "account_status" => $n_account_status,
|
||||
"c_loginid" => $c_loginid,
|
||||
"groups" => $phpgw->accounts->groups_array_to_string($n_groups)));
|
||||
}
|
||||
|
@ -219,7 +219,65 @@
|
||||
|
||||
function account_edit($account_info)
|
||||
{
|
||||
|
||||
global $phpgw, $phpgw_info, $ldap;
|
||||
|
||||
// This is just until the API fully handles reading the LDAP account info.
|
||||
$lid = $account_info["loginid"];
|
||||
if ($account_info["c_loginid"]) {
|
||||
$phpgw->db->query("update accounts set account_lid='" . $account_info["c_loginid"]
|
||||
. "' where account_lid='" . $account_info["loginid"] . "'");
|
||||
|
||||
$account_info["loginid"] = $account_info["c_loginid"];
|
||||
|
||||
$entry["uid"] = $account_info["loginid"];
|
||||
$entry["homeDirectory"] = "/home/" . $account_info["loginid"];
|
||||
$entry["mail"] = $account_info["loginid"] . "@" . $phpgw_info["server"]["mail_suffix"];
|
||||
}
|
||||
|
||||
if ($account_info["passwd"]) {
|
||||
$entry["userpassword"] = $phpgw->common->encrypt_password($n_passwd);
|
||||
|
||||
// Update the sessions table. (The user might be logged in)
|
||||
$phpgw->db->query("update sessions set session_pwd='" . $phpgw->common->encrypt($n_passwd) . "' "
|
||||
. "where session_lid='$lid'");
|
||||
}
|
||||
|
||||
while ($permission = each($account_info["permissions"])) {
|
||||
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
|
||||
$phpgw->accounts->add_app($permission[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $account_info["account_status"]) {
|
||||
$account_info["account_status"] = "L";
|
||||
}
|
||||
|
||||
$phpgw->db->query("update accounts set account_firstname='"
|
||||
. addslashes($account_info["firstname"]) . "', account_lastname='"
|
||||
. addslashes($account_info["lastname"]) . "', account_permissions='"
|
||||
. $phpgw->accounts->add_app("",True) . "', account_status='"
|
||||
. $account_info["account_status"] . "', account_groups='"
|
||||
. $account_info["groups"] . "' where account_lid='" . $account_info["loginid"]
|
||||
. "'");
|
||||
|
||||
$entry["cn"] = sprintf("%s %s", $account_info["firstname"], $account_info["lastname"]);
|
||||
$entry["sn"] = $account_info["lastname"];
|
||||
$entry["givenname"] = $account_info["firstname"];
|
||||
|
||||
$dn = sprintf("uid=%s, %s", $phpgw_info["user"]["userid"],$phpgw_info["server"]["ldap_context"]);
|
||||
@ldap_modify($ldap, $dn, $entry);
|
||||
|
||||
$cd = 27;
|
||||
if ($account_info["c_loginid"] != $account_info["loginid"]) {
|
||||
$sep = $phpgw->common->filesystem_separator();
|
||||
|
||||
$basedir = $phpgw_info["server"]["files_dir"] . $sep . "users" . $sep;
|
||||
|
||||
if (! @rename($basedir . $lid, $basedir . $account_info["loginid"])) {
|
||||
$cd = 35;
|
||||
}
|
||||
}
|
||||
return $cd;
|
||||
}
|
||||
|
||||
function account_delete($account_id)
|
||||
|
@ -16,14 +16,10 @@
|
||||
|
||||
$phpgw_info["flags"]["currentapp"] = "preferences";
|
||||
include("../header.inc.php");
|
||||
if ($phpgw_info["user"]["permissions"]["anonymous"]) {
|
||||
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/"));
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! $submit) {
|
||||
$phpgw->common->phpgw_header();
|
||||
$phpgw->common->navbar();
|
||||
if (! $submit) {
|
||||
$phpgw->common->phpgw_header();
|
||||
$phpgw->common->navbar();
|
||||
|
||||
?>
|
||||
<form method="POST" acion="<?php echo $phpgw->link("changepassword.php"); ?>">
|
||||
@ -85,15 +81,7 @@ if (! $submit) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($phpgw_info["server"]["ldap_encryption_type"] == "DES") {
|
||||
$salt = $phpgw->common->randomstring(2);
|
||||
$n_passwd = $phpgw->common->des_cryptpasswd($n_passwd, $salt);
|
||||
}
|
||||
if ($phpgw_info["server"]["ldap_encryption_type"] == "MD5") {
|
||||
$salt = $phpgw->common->randomstring(9);
|
||||
$n_passwd = $phpgw->common->md5_cryptpasswd($n_passwd, $salt);
|
||||
}
|
||||
$entry["userpassword"] = $n_passwd;
|
||||
$entry["userpassword"] = $phpgw->common->encrypt_password($n_passwd);
|
||||
|
||||
$dn = sprintf("uid=%s, %s", $phpgw_info["user"]["userid"],$phpgw_info["server"]["ldap_context"]);
|
||||
@ldap_modify($ldap, $dn, $entry);
|
||||
|
@ -155,13 +155,7 @@
|
||||
} else {
|
||||
$phpgw->common->preferences_delete("byappnotheme",$phpgw_info["user"]["account_id"],"common");
|
||||
|
||||
// If they don't have permissions to the headlines,
|
||||
// we don't need to lock the table.
|
||||
if ($phpgw_info["user"]["apps"]["headlines"]) {
|
||||
$phpgw->db->lock(array("preferences","users_headlines"));
|
||||
} else {
|
||||
$phpgw->db->lock("preferences");
|
||||
}
|
||||
$phpgw->db->lock("preferences");
|
||||
|
||||
$phpgw->common->preferences_add($phpgw_info["user"]["account_id"],"maxmatchs","common");
|
||||
$phpgw->common->preferences_add($phpgw_info["user"]["account_id"],"tz_offset","common");
|
||||
|
Loading…
Reference in New Issue
Block a user