2014-05-30 Hirofumi Kosaka <kosaka@rworks.jp>

* include/javascript/jquery.pandora.controls.js,
	godmode/groups/group_list.php,
	godmode/massive/massive_add_alerts.php,
	godmode/massive/massive_add_action_alerts.php
	godmode/massive/massive_delete_action_alerts.php,
	godmode/massive/massive_delete_alerts.php,
	godmode/massive/massive_enable_disable_alerts.php,
	godmode/massive/massive_standby_alerts.php: fixed bug that all
	agents would be shown in the target for masssive operations, if
	the user has an AW privilege for any agent (group).



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10048 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
hkosaka 2014-05-30 11:01:22 +00:00
parent 37449da615
commit e32e9c2182
9 changed files with 75 additions and 16 deletions

View File

@ -1,3 +1,16 @@
2014-05-30 Hirofumi Kosaka <kosaka@rworks.jp>
* include/javascript/jquery.pandora.controls.js,
godmode/groups/group_list.php,
godmode/massive/massive_add_alerts.php,
godmode/massive/massive_add_action_alerts.php
godmode/massive/massive_delete_action_alerts.php,
godmode/massive/massive_delete_alerts.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_standby_alerts.php: Fixed bug that all
agents would be shown in the target for masssive operations, if
the user has an AW privilege for any agent (group).
2014-05-30 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/agent_manager.php,

View File

@ -67,6 +67,7 @@ if (is_ajax ()) {
$disabled = (int) get_parameter ('disabled', 0);
$search = (string) get_parameter ('search', '');
$recursion = (int) get_parameter ('recursion', 0);
$privilege = (string) get_parameter ('privilege', '');
// Is is possible add keys prefix to avoid auto sorting in js object conversion
$keys_prefix = (string) get_parameter ('keys_prefix', '');
// Ids of agents to be include in the SQL clause as id_agent IN ()
@ -104,10 +105,18 @@ if (is_ajax ()) {
$filter[$_sql_post] = '1';
}
$agents = agents_get_group_agents($id_group, $filter, "none",
false, $recursion);
if ( $id_group == 0 && $privilege != '') {
// if group ID doesn't matter and $privilege is specified (like 'AW'),
// retruns all agents that current user has $privilege privilege for.
$agents = agents_get_group_agents(
array_keys (users_get_groups ($config["id_user"], $privilege, false)));
}
else {
$agents = agents_get_group_agents($id_group, $filter, "none",
false, $recursion);
}
// Add keys prefix
if ($keys_prefix !== "") {
foreach($agents as $k => $v) {

View File

@ -109,6 +109,11 @@ if ($add) {
}
$groups = users_get_groups ();
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
// Avoid php warning
if (empty($alert_templates)) {
@ -129,8 +134,8 @@ $table->size[3] = '35%';
$table->data = array ();
$table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group,
false, '', '', true);
$table->data[0][1] = html_print_select_groups(false, "AW", $return_all_group,
'id_group', $id_group, false, '', '', true);
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion, true, false);
@ -197,6 +202,7 @@ $(document).ready (function () {
$("#id_group").pandoraSelectGroupAgent ({
agentSelect: "select#id_agents",
privilege: "AW",
recursion: function() {return recursion},
filter_agents_json: filter_agents_json,
callbackPost: function () {

View File

@ -38,7 +38,8 @@ if (is_ajax ()) {
// Is is possible add keys prefix to avoid auto sorting in js object conversion
$keys_prefix = (string) get_parameter ('keys_prefix', '');
$agents = agents_get_group_agents ($id_group, false, "", false, $recursion);
$agents = agents_get_group_agents ( array_keys (users_get_groups ($config["id_user"], "AW", false)),
false, "", false, $recursion);
// Add keys prefix
if ($keys_prefix !== "") {
@ -113,6 +114,11 @@ if ($add) {
}
$groups = users_get_groups ();
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
$table->id = 'add_table';
$table->width = '98%';
@ -129,7 +135,7 @@ $table->size[3] = '40%';
$table->data = array ();
$table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', 0,
$table->data[0][1] = html_print_select_groups(false, "AW", $return_all_group, 'id_group', 0,
'', 'Select', -1, true, false, true, '', false, 'width:180px;');
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion, true, false);
@ -140,6 +146,7 @@ $table->data[1][0] .= html_print_image('images/spinner.png', true);
$table->data[1][0] .= '</span>';
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_template, $id_group,
false, array ('tagente.nombre', 'tagente.id_agente'));
$agents = agents_get_agents();
$table->data[1][1] = html_print_select (index_array ($agents, 'id_agente', 'nombre'),
'id_agents[]', '', '', '', '', true, true, true, '', false, 'width:180px;');

View File

@ -115,6 +115,11 @@ if ($delete) {
}
$groups = users_get_groups ();
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
$table->id = 'delete_table';
$table->width = '98%';
@ -130,7 +135,7 @@ $table->size[3] = '35%';
$table->data = array ();
$table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group,
$table->data[0][1] = html_print_select_groups(false, "AW", $return_all_group, 'id_group', $id_group,
false, '', '', true);
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion, true, false);
@ -201,6 +206,7 @@ $(document).ready (function () {
$("#id_group").pandoraSelectGroupAgent ({
agentSelect: "select#id_agents",
privilege: "AW",
recursion: function() {return recursion},
filter_agents_json: filter_agents_json,
callbackPost: function () {

View File

@ -181,6 +181,11 @@ if ($delete) {
}
$groups = users_get_groups ();
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
$table->id = 'delete_table';
$table->width = '98%';
@ -204,7 +209,7 @@ $table->data[0][2] = '';
$table->data[0][3] = '';
$table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group,
$table->data[1][1] = html_print_select_groups(false, "AW", $return_all_group, 'id_group', $id_group,
'', '', '', true, false, true, '', $id_alert_template == 0);
$table->data[1][2] = __('Group recursion');
$table->data[1][3] = html_print_checkbox ("recursion", 1, false, true, false);

View File

@ -109,6 +109,11 @@ switch ($action) {
}
$groups = users_get_groups ();
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
$table->id = 'delete_table';
$table->width = '98%';
@ -128,7 +133,7 @@ $table->data[0][0] = '<form method="post" id="form_alerts" action="index.php?sec
$table->data[0][0] .= html_print_input_hidden('id_alert_template_enabled', $id_alert_templates, true);
$table->data[0][0] .= __('Group');
$table->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', '', true);
$table->data[0][1] = html_print_select_groups(false, "AW", $return_all_group, 'id_group', $id_group, '', '', '', true);
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion, true, false);
@ -136,7 +141,7 @@ $table->data[1][0] = __('Agents');
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
$table->data[1][0] .= html_print_image("images/spinner.png", true);
$table->data[1][0] .= '</span>';
$table->data[1][1] = html_print_select (agents_get_group_agents ($id_group, false, "none"),
$table->data[1][1] = html_print_select (agents_get_group_agents (array_keys (users_get_groups ($config["id_user"], "AW", false))),
'id_agents[]', 0, false, '', '', true, true);
$table->data[2][0] = __('Alert template');
@ -191,6 +196,7 @@ $(document).ready (function () {
$("#id_group").pandoraSelectGroupAgent ({
agentSelect: "select#id_agents",
privilege: "AW",
recursion: function() {return recursion},
callbackPost: function () {
clear_alert_fields();

View File

@ -109,6 +109,11 @@ switch($action) {
}
$groups = users_get_groups ();
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
$table->id = 'delete_table';
$table->width = '98%';
@ -128,8 +133,8 @@ $templates = alerts_get_alert_templates (false, array ('id', 'name'));
$table->data[0][0] = '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_alerts&option=standby_alerts&action=set_standby_alerts">';
$table->data[0][0] .= html_print_input_hidden('id_alert_template_not_standby', $id_alert_templates, true);
$table->data[0][0] .= __('Group');
$table->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group,
'', '', '', true, false, true, '');
$table->data[0][1] = html_print_select_groups(false, "AW", $return_all_group,
'id_group', $id_group, '', '', '', true, false, true, '');
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion, true, false);
@ -137,9 +142,8 @@ $table->data[1][0] = __('Agents');
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
$table->data[1][0] .= html_print_image('images/spinner.png', true);
$table->data[1][0] .= '</span>';
$table->data[1][1] = html_print_select (agents_get_group_agents ($id_group, false, "none"),
$table->data[1][1] = html_print_select (agents_get_group_agents (array_keys (users_get_groups ($config["id_user"], "AW", false))),
'id_agents[]', 0, false, '', '', true, true);
$table->data[2][0] = __('Alert template');
$table->data[2][0] .= '<span id="template_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
@ -192,6 +196,7 @@ $(document).ready (function () {
$("#id_group").pandoraSelectGroupAgent ({
agentSelect: "select#id_agents",
privilege: "AW",
recursion: function() {return recursion},
callbackPost: function () {
clear_alert_fields();

View File

@ -18,6 +18,7 @@
callbackAfter: dummyFunc,
debug: false,
disabled: disabled || false,
privilege: "",
};
/* public methods */
@ -43,6 +44,7 @@
"filter_agents_json" : config.filter_agents_json,
"disabled" : config.disabled ? 1 : 0,
"status_agents" : config.status_agents,
"privilege" : config.privilege,
// Add a key prefix to avoid auto sorting in js object conversion
"keys_prefix" : "_"
};