2012-01-03 Sergio Martin <sergio.martin@artica.es>
* include/functions_users.php include/auth/mysql.php pandoradb.sql pandoradb.postgreSQL.sql pandoradb.oracle.sql extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql godmode/users/user_list.php: Added to users the disable/enable feature git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5315 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
de957d4d52
commit
9287abce07
|
@ -1,3 +1,16 @@
|
|||
2012-01-03 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_users.php
|
||||
include/auth/mysql.php
|
||||
pandoradb.sql
|
||||
pandoradb.postgreSQL.sql
|
||||
pandoradb.oracle.sql
|
||||
extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql
|
||||
extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql
|
||||
extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql
|
||||
godmode/users/user_list.php: Added to users the
|
||||
disable/enable feature
|
||||
|
||||
2012-01-03 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* pandoradb.data.postgreSQL.sql
|
||||
|
|
|
@ -60,3 +60,9 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report_content` (
|
|||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `tusuario` ADD COLUMN `disabled` int(4) NOT NULL DEFAULT 0;
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
-- -----------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
alter table tusuario add (disabled NUMBER(10,0) default 0 NOT NULL);
|
|
@ -0,0 +1,5 @@
|
|||
-- -----------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE "tusuario" ADD COLUMN "disabled" INTEGER NOT NULL DEFAULT 0;
|
|
@ -105,6 +105,8 @@ $buttons[$tab]['active'] = true;
|
|||
// Header
|
||||
ui_print_page_header (__('User management').' » '.__('Users defined in Pandora'), "images/god3.png", false, "", true, $buttons);
|
||||
|
||||
$disable_user = get_parameter ("disable_user", false);
|
||||
|
||||
if (isset ($_GET["user_del"])) { //delete user
|
||||
$id_user = get_parameter ("delete_user", 0);
|
||||
// Only allow delete user if is not the actual user
|
||||
|
@ -129,6 +131,27 @@ elseif (isset ($_GET["profile_del"])) { //delete profile
|
|||
__('Successfully deleted'),
|
||||
__('There was a problem deleting the profile'));
|
||||
}
|
||||
elseif ($disable_user !== false) { //disable_user
|
||||
$id_user = get_parameter ("id", 0);
|
||||
|
||||
if($id_user !== 0) {
|
||||
$result = users_disable ($id_user, $disable_user);
|
||||
}
|
||||
else {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
if($disable_user == 1) {
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully disabled'),
|
||||
__('There was a problem disabling user'));
|
||||
}
|
||||
else {
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully enabled'),
|
||||
__('There was a problem enabling user'));
|
||||
}
|
||||
}
|
||||
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
|
@ -155,7 +178,7 @@ $table->head[5] = '<span title="Operations">' . __('Op.') . '</span>';
|
|||
$table->align[2] = "center";
|
||||
$table->align[3] = "center";
|
||||
$table->align[5] = "left";
|
||||
$table->size[5] = '45px';
|
||||
$table->size[5] = '65px';
|
||||
|
||||
$info1 = array ();
|
||||
|
||||
|
@ -228,7 +251,13 @@ foreach ($info as $user_id => $user_info) {
|
|||
|
||||
$data[4] = ui_print_string_substr ($user_info["comments"], 24, true);
|
||||
|
||||
$data[5] = '<a href="index.php?sec=gusuarios&sec2=godmode/users/configure_user&id='.$user_id.'">'.html_print_image('images/config.png', true, array('title' => __('Edit'))).'</a>';
|
||||
if($user_info['disabled'] == 0) {
|
||||
$data[5] = '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list&disable_user=1&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, array('title' => __('Disable'))).'</a>';
|
||||
}
|
||||
else {
|
||||
$data[5] = '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list&disable_user=0&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb_off.png', true, array('title' => __('Enable'))).'</a>';
|
||||
}
|
||||
$data[5] .= '<a href="index.php?sec=gusuarios&sec2=godmode/users/configure_user&id='.$user_id.'">'.html_print_image('images/config.png', true, array('title' => __('Edit'))).'</a>';
|
||||
if ($config["admin_can_delete_user"] && $user_info['id_user'] != $config['id_user']) {
|
||||
$data[5] .= " <a href='index.php?sec=gusuarios&sec2=godmode/users/user_list&user_del=1&delete_user=".$user_info['id_user']."'>".html_print_image('images/cross.png', true, array ('title' => __('Delete'), 'onclick' => "if (! confirm ('" .__('Deleting User'). " ". $user_info['id_user'] . ". " . __('Are you sure?') ."')) return false"))."</a>";
|
||||
} else {
|
||||
|
|
|
@ -80,13 +80,13 @@ function process_user_login ($login, $pass) {
|
|||
// Connect to Database
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ("SELECT `id_user`, `password` FROM `tusuario` WHERE `id_user` = '%s'", $login);
|
||||
$sql = sprintf ("SELECT `id_user`, `password` FROM `tusuario` WHERE `id_user` = '%s' AND `disabled` = 0", $login);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('SELECT "id_user", "password" FROM "tusuario" WHERE "id_user" = \'%s\'', $login);
|
||||
$sql = sprintf ('SELECT "id_user", "password" FROM "tusuario" WHERE "id_user" = \'%s\' AND "disabled" = 0', $login);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ('SELECT id_user, password FROM tusuario WHERE id_user = \'%s\'', $login);
|
||||
$sql = sprintf ('SELECT id_user, password FROM tusuario WHERE id_user = \'%s\' AND disabled = 0', $login);
|
||||
break;
|
||||
}
|
||||
$row = db_get_row_sql ($sql);
|
||||
|
|
|
@ -38,6 +38,18 @@ function users_get_info ($order = "fullname", $info = "fullname") {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable a user
|
||||
*
|
||||
* @param int user id
|
||||
* @param int new disabled value (0 when enable, 1 when disable)
|
||||
*
|
||||
* @return int sucess return
|
||||
*/
|
||||
function users_disable ($user_id, $new_disabled_value) {
|
||||
return db_process_sql_update('tusuario', array('disabled' => $new_disabled_value), array('id_user' => $user_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the Model groups a user has reading privileges.
|
||||
*
|
||||
|
|
|
@ -840,7 +840,8 @@ CREATE TABLE tusuario (
|
|||
timezone VARCHAR2(50) default '',
|
||||
block_size NUMBER(10, 0) default 20 NOT NULL,
|
||||
flash_chart NUMBER(10, 0) default 1 NOT NULL,
|
||||
id_skin NUMBER(10, 0) DEFAULT 0 NOT NULL
|
||||
id_skin NUMBER(10, 0) DEFAULT 0 NOT NULL,
|
||||
disabled NUMBER(10, 0) default 0 NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE tusuario_perfil (
|
||||
|
|
|
@ -674,7 +674,8 @@ CREATE TABLE "tusuario" (
|
|||
"timezone" varchar(50) default '',
|
||||
"block_size" INTEGER NOT NULL default 20,
|
||||
"flash_chart" INTEGER NOT NULL default 1,
|
||||
"id_skin" INTEGER NOT NULL DEFAULT 0
|
||||
"id_skin" INTEGER NOT NULL DEFAULT 0,
|
||||
"disabled" INTEGER NOT NULL default 1
|
||||
);
|
||||
|
||||
CREATE TABLE "tusuario_perfil" (
|
||||
|
|
|
@ -750,6 +750,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
|
|||
`block_size` int(4) NOT NULL DEFAULT 20,
|
||||
`flash_chart` int(4) NOT NULL DEFAULT 1,
|
||||
`id_skin` int(10) unsigned NOT NULL,
|
||||
`disabled` int(4) NOT NULL DEFAULT 0,
|
||||
UNIQUE KEY `id_user` (`id_user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
Loading…
Reference in New Issue