mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
2009-01-22 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/auth/mysql.php, include/auth/ldap.php, operation/users/user_edit.php, godmode/users/configure_user.php, godmode/users/user_list.php: Fixed some minor problems and annoyances git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1391 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
6fa769e08c
commit
3b3427c1f1
@ -1,3 +1,9 @@
|
|||||||
|
2009-01-22 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||||
|
|
||||||
|
* include/auth/mysql.php, include/auth/ldap.php,
|
||||||
|
operation/users/user_edit.php, godmode/users/configure_user.php,
|
||||||
|
godmode/users/user_list.php: Fixed some minor problems and annoyances
|
||||||
|
|
||||||
2009-01-22 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
2009-01-22 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||||
|
|
||||||
* pandoradb_migrate_20_to_21.sql, pandoradb.sql: Added user table updates
|
* pandoradb_migrate_20_to_21.sql, pandoradb.sql: Added user table updates
|
||||||
|
@ -47,43 +47,52 @@ if (isset ($_GET["create"]) && $config["admin_can_add_user"]) {
|
|||||||
$user_info["email"] = '';
|
$user_info["email"] = '';
|
||||||
$user_info["phone"] = '';
|
$user_info["phone"] = '';
|
||||||
$user_info["comments"] = '';
|
$user_info["comments"] = '';
|
||||||
|
$user_info["is_admin"] = 0;
|
||||||
} elseif (isset ($_GET["create"])) {
|
} elseif (isset ($_GET["create"])) {
|
||||||
print_error_message (false, '', __('The current authentication scheme doesn\'t support creating users from Pandora FMS'));
|
print_error_message (false, '', __('The current authentication scheme doesn\'t support creating users from Pandora FMS'));
|
||||||
} elseif (isset ($_GET["user_mod"])) {
|
} elseif (isset ($_GET["user_mod"])) {
|
||||||
$mod = get_parameter_get ("user_mod", 0); //0 is no user info modify (can modify passwords and admin status), 1 is modify, 2 is create
|
$mod = get_parameter_get ("user_mod", 0); //0 is no user info modify (can modify passwords and admin status), 1 is modify, 2 is create
|
||||||
|
|
||||||
$upd_info = array ();
|
$upd_info = array ();
|
||||||
$upd_info["fullname"] = get_parameter_post ("fullname", $user_info["fullname"]);
|
$upd_info["fullname"] = get_parameter_post ("fullname");
|
||||||
$upd_info["firstname"] = get_parameter_post ("firstname", $user_info["firstname"]);
|
$upd_info["firstname"] = get_parameter_post ("firstname");
|
||||||
$upd_info["lastname"] = get_parameter_post ("lastname", $user_info["lastname"]);
|
$upd_info["lastname"] = get_parameter_post ("lastname");
|
||||||
$password_old = get_parameter_post ("password_old", "-");
|
$password_old = get_parameter_post ("password_old", "-");
|
||||||
$password_new = get_parameter_post ("password_new", "-");
|
$password_new = get_parameter_post ("password_new", "-");
|
||||||
$password_confirm = get_parameter_post ("password_confirm", "-");
|
$password_confirm = get_parameter_post ("password_confirm", "-");
|
||||||
$upd_info["email"] = get_parameter_post ("email", $user_info["email"]);
|
$upd_info["email"] = get_parameter_post ("email");
|
||||||
$upd_info["phone"] = get_parameter_post ("phone", $user_info["phone"]);
|
$upd_info["phone"] = get_parameter_post ("phone");
|
||||||
$upd_info["comments"] = get_parameter_post ("comments", $user_info["comments"]);
|
$upd_info["comments"] = get_parameter_post ("comments");
|
||||||
$is_admin = get_parameter_post ("is_admin", $user_info["is_admin"]);
|
$is_admin = get_parameter_post ("is_admin", 0);
|
||||||
$group = get_parameter_post ("assign_group", 0);
|
$group = get_parameter_post ("assign_group", 0);
|
||||||
$profile = get_parameter_post ("assign_profile", 0);
|
$profile = get_parameter_post ("assign_profile", 0);
|
||||||
|
|
||||||
|
|
||||||
if ($config["admin_can_add_user"] && $mod == 2) {
|
if ($config["admin_can_add_user"] && $mod == 2) {
|
||||||
if ($password_new !== $password_confirm) {
|
if ($password_new != $password_confirm) {
|
||||||
print_error_message (false, '', __('Passwords didn\t match'));
|
print_error_message (false, '', __('Passwords didn\t match'));
|
||||||
|
$id = '';
|
||||||
$user_info = $upd_info; //Fill in the blanks again
|
$user_info = $upd_info; //Fill in the blanks again
|
||||||
|
$user_info["is_admin"] = $is_admin;
|
||||||
|
$_GET["create"] = 1; //Set create mode back on
|
||||||
|
$password_old = "-";
|
||||||
|
$password_new = "-";
|
||||||
|
$password_confirm = "-";
|
||||||
} else {
|
} else {
|
||||||
$id = get_parameter_post ("id_user");
|
$id = get_parameter_post ("id_user");
|
||||||
$return = create_user ($id, $password_new, $upd_info);
|
$return = create_user ($id, $password_new, $upd_info);
|
||||||
print_error_message ($return, __('User successfully created'), __('Error creating user'));
|
print_error_message ($return, __('User successfully created'), __('Error creating user'));
|
||||||
$user_info = get_user_info ($id);
|
$user_info = get_user_info ($id);
|
||||||
$id = $user_info["id_user"];
|
$id = $user_info["id_user"];
|
||||||
$_GET["create"] = 1; //Set create mode back on
|
$password_old = "-";
|
||||||
|
$password_new = "-";
|
||||||
|
$password_confirm = "-";
|
||||||
}
|
}
|
||||||
} elseif ($config["user_can_update_info"] && mod == 1) {
|
} elseif ($config["user_can_update_info"] && $mod == 1) {
|
||||||
$return = process_user_info ($id, $upd_info);
|
$return = process_user_info ($id, $upd_info);
|
||||||
print_error_message ($return, __('User info successfully updated'), __('Error updating user info'));
|
print_error_message ($return, __('User info successfully updated'), __('Error updating user info (no change?)'));
|
||||||
$user_info = get_user_info ($id);
|
$user_info = $upd_info;
|
||||||
$id = $user_info["id_user"];
|
$user_info["is_admin"] = $is_admin;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If User can update password and the new password is not the same as the old one, it's not the default and it's not empty and the new password is the same as the confirmed one
|
//If User can update password and the new password is not the same as the old one, it's not the default and it's not empty and the new password is the same as the confirmed one
|
||||||
@ -112,9 +121,9 @@ if (isset ($_GET["create"]) && $config["admin_can_add_user"]) {
|
|||||||
echo "<h2>".__('Pandora users')." > ".__('User detail editor')."</h2>";
|
echo "<h2>".__('Pandora users')." > ".__('User detail editor')."</h2>";
|
||||||
|
|
||||||
if (!empty ($id)) {
|
if (!empty ($id)) {
|
||||||
echo '<form name="user_mod" method="post" action="index.php?sec=usuarios&sec2=godmode/users/configure_user&id='.$id.'&user_mod=1">';
|
echo '<form name="user_mod" method="post" action="index.php?sec=gusuarios&sec2=godmode/users/configure_user&id='.$id.'&user_mod=1">';
|
||||||
} else {
|
} else {
|
||||||
echo '<form name="user_create" method="post" action="index.php?sec=usuarios&sec2=godmode/users/configure_user&user_mod=2">';
|
echo '<form name="user_create" method="post" action="index.php?sec=gusuarios&sec2=godmode/users/configure_user&user_mod=2">';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<table cellpadding="4" cellspacing="4" class="databox_color" width="600px">';
|
echo '<table cellpadding="4" cellspacing="4" class="databox_color" width="600px">';
|
||||||
@ -135,12 +144,12 @@ print_input_text_extended ("lastname", $user_info["lastname"], '', '', '', '', $
|
|||||||
echo '</td></tr><tr><td class="datos">'.__('Password').'</td><td class="datos">';
|
echo '</td></tr><tr><td class="datos">'.__('Password').'</td><td class="datos">';
|
||||||
if ($config["user_can_update_password"]) {
|
if ($config["user_can_update_password"]) {
|
||||||
if (!isset ($_GET["create"])) {
|
if (!isset ($_GET["create"])) {
|
||||||
print_input_text_extended ("password_old", "", '', '', '', '', $view_mode, '', 'class="input"', false, true);
|
print_input_text_extended ("password_old", "-", '', '', '', '', $view_mode, '', 'class="input"', false, true);
|
||||||
}
|
}
|
||||||
echo '</td></tr><tr><td class="datos">'.__('New Password').'</td><td class="datos">';
|
echo '</td></tr><tr><td class="datos">'.__('New Password').'</td><td class="datos">';
|
||||||
print_input_text_extended ("password_new", "", '', '', '', '', $view_mode, '', 'class="input"', false, true);
|
print_input_text_extended ("password_new", "-", '', '', '', '', $view_mode, '', 'class="input"', false, true);
|
||||||
echo '</td></tr><tr><td class="datos">'.__('Password confirmation').'</td><td class="datos">';
|
echo '</td></tr><tr><td class="datos">'.__('Password confirmation').'</td><td class="datos">';
|
||||||
print_input_text_extended ("password_conf", "", '', '', '', '', $view_mode, '', 'class="input"', false, true);
|
print_input_text_extended ("password_confirm", "-", '', '', '', '', $view_mode, '', 'class="input"', false, true);
|
||||||
} else {
|
} else {
|
||||||
echo '<i>'.__('You can not change passwords from Pandora FMS under the current authentication scheme').'</i>';
|
echo '<i>'.__('You can not change passwords from Pandora FMS under the current authentication scheme').'</i>';
|
||||||
}
|
}
|
||||||
@ -201,7 +210,7 @@ $table->align[1] = 'center';
|
|||||||
$table->align[2] = 'center';
|
$table->align[2] = 'center';
|
||||||
|
|
||||||
|
|
||||||
$result = get_db_all_rows_field_filter ("tusuario_perfil", "id_usuario", $user_info["id_user"]);
|
$result = get_db_all_rows_field_filter ("tusuario_perfil", "id_usuario", $id);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
$result = array ();
|
$result = array ();
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ $info = array ();
|
|||||||
$info = get_users ();
|
$info = get_users ();
|
||||||
|
|
||||||
foreach ($info as $user_id => $user_info) {
|
foreach ($info as $user_id => $user_info) {
|
||||||
$data[0] = '<a href="index.php?sec=usuarios&sec2=operation/users/user_edit&id='.$user_id.'">'.$user_id.'</a>';
|
$data[0] = '<a href="index.php?sec=gusuarios&sec2=godmode/users/configure_user&id='.$user_id.'">'.$user_id.'</a>';
|
||||||
$data[1] = $user_info["fullname"].'<a href="#" class="tip"><span>';
|
$data[1] = $user_info["fullname"].'<a href="#" class="tip"><span>';
|
||||||
$data[1] .= __('First name').': '.$user_info["firstname"].'<br />';
|
$data[1] .= __('First name').': '.$user_info["firstname"].'<br />';
|
||||||
$data[1] .= __('Last name').': '.$user_info["lastname"].'<br />';
|
$data[1] .= __('Last name').': '.$user_info["lastname"].'<br />';
|
||||||
|
@ -189,6 +189,15 @@ function process_user_contact ($id_user) {
|
|||||||
//Empty function
|
//Empty function
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the user admin status (LDAP doesn't do this)
|
||||||
|
*
|
||||||
|
* @param string User id
|
||||||
|
*/
|
||||||
|
function process_user_isadmin ($id_user, $is_admin) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LDAP user functions based on webcalendar's implementation
|
* LDAP user functions based on webcalendar's implementation
|
||||||
*
|
*
|
||||||
|
@ -185,9 +185,7 @@ function create_user ($id_user, $password, $user_info) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process_sql_insert ("tusuario", $values);
|
return process_sql_insert ("tusuario", $values);
|
||||||
|
|
||||||
return (bool) process_sql ($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -242,6 +240,20 @@ function process_user_info ($id_user, $user_info) {
|
|||||||
return process_sql_update ("tusuario", $values, array ("id_user" => $id_user));
|
return process_sql_update ("tusuario", $values, array ("id_user" => $id_user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the user admin status (LDAP doesn't do this)
|
||||||
|
*
|
||||||
|
* @param string User id
|
||||||
|
*/
|
||||||
|
function process_user_isadmin ($id_user, $is_admin) {
|
||||||
|
if ($is_admin == true) {
|
||||||
|
$is_admin = 1;
|
||||||
|
} else {
|
||||||
|
$is_admin = 0;
|
||||||
|
}
|
||||||
|
return process_sql_update ("tusuario", array ("is_admin" => $is_admin), array ("id_user" => $id_user));
|
||||||
|
}
|
||||||
|
|
||||||
//Reference the global use authorization error to last auth error.
|
//Reference the global use authorization error to last auth error.
|
||||||
$config["auth_error"] = &$mysql_cache["auth_error"];
|
$config["auth_error"] = &$mysql_cache["auth_error"];
|
||||||
?>
|
?>
|
@ -53,7 +53,7 @@ if (isset ($_GET["modified"]) && !$view_mode) {
|
|||||||
|
|
||||||
$return = process_user_info ($id, $upd_info);
|
$return = process_user_info ($id, $upd_info);
|
||||||
print_error_message ($return, __('User info successfully updated'), __('Error updating user info'));
|
print_error_message ($return, __('User info successfully updated'), __('Error updating user info'));
|
||||||
$user_info = get_user_info ($id); //Reread it
|
$user_info = $upd_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<h2>".__('Pandora users')." > ".__('User detail editor')."</h2>";
|
echo "<h2>".__('Pandora users')." > ".__('User detail editor')."</h2>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user