From 9b7dfe73159d9a948755c6895587fdfa25390717 Mon Sep 17 00:00:00 2001 From: skeeter Date: Thu, 4 Jan 2001 20:06:38 +0000 Subject: [PATCH] should allow changing of account prefs using ldap or sql --- admin/editaccount.php | 50 ++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/admin/editaccount.php b/admin/editaccount.php index 02e1042d6d..f82c247660 100755 --- a/admin/editaccount.php +++ b/admin/editaccount.php @@ -64,9 +64,8 @@ } if (! $totalerrors) { - $phpgw->db->query("SELECT account_permissions, account_id FROM accounts WHERE account_lid='" . $old_loginid . "'",__LINE__,__FILE__); + $phpgw->db->query("SELECT account_id FROM accounts WHERE account_lid='" . $old_loginid . "'",__LINE__,__FILE__); $phpgw->db->next_record(); - $apps_before = $phpgw->db->f("account_permissions"); $account_id = $phpgw->db->f("account_id"); while ($permission = each($new_permissions)) { @@ -75,14 +74,6 @@ } } $apps_after = $phpgw->accounts->add_app("",True); - if($apps_before <> $apps_after) { - $after_apps = explode(":",$apps_after); - for ($i=1;$i<=count($after_apps);$i++) { - if (!strpos(" ".$apps_before." ",$after_apps)) { - $new_apps[] = $after_apps; - } - } - } $cd = account_edit(array("loginid" => $n_loginid, "permissions" => $new_permissions, "firstname" => $n_firstname, "lastname" => $n_lastname, @@ -93,32 +84,33 @@ // If the user is logged in, it will force a refresh of the session_info $phpgw->db->query("update phpgw_sessions set session_info='' where session_lid='$new_loginid@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__); + + // The following sets any default preferences needed for new applications.. // This is smart enough to know if previous preferences were selected, use them. - if (count($new_apps)) { - - $pref = new preferences($account_id); - $t = $pref->get_preferences(); + + $pref = new preferences($account_id); + $t = $pref->get_preferences(); - $docommit = False; + $docommit = False; - for ($j=0;$jcommon->hook_single("add_def_pref", $new_apps[$j]); - $docommit = True; - } + while(list($key,$value) = each($phpgw_info["user"]["app_perms"])) { + if($value=="admin") { + $check = "common"; + } else { + $check = $value; + } + if (!count($t["$check"])) { + $phpgw->common->hook_single("add_def_pref", $value); + $docommit = True; } - if ($docommit) { - $pref->commit(); - } } - // start inlcuding other admin tools + if ($docommit) { + $pref->commit(); + } + + // start including other admin tools while(list($key,$value) = each($phpgw_info["user"]["app_perms"])) { $phpgw->common->hook_single("update_user_data", $value);