ACL improvements
This commit is contained in:
parent
9b1a57a89d
commit
481addb514
|
@ -1307,12 +1307,27 @@ class Tree {
|
|||
$module['serverTypeHTML'] = servers_show_type($module['server_type']);
|
||||
|
||||
// Link to the Module graph
|
||||
$group_id = (int) modules_get_agent_group($module['id']);
|
||||
$module["showGraphs"] = 0;
|
||||
|
||||
// ACL
|
||||
if (!empty($group_id)) {
|
||||
$module["showGraphs"] = (int) check_acl($config['id_user'], $group_id, "RR");
|
||||
$group_id = (int) modules_get_agent_group($module['id']);
|
||||
$acl_graphs = false;
|
||||
$module["showGraphs"] = 0;
|
||||
|
||||
// Avoid the check on the metaconsole. Too slow to show/hide an icon depending on the permissions
|
||||
if (!empty($group_id) && !defined("METACONSOLE")) {
|
||||
if ($this->strictACL) {
|
||||
$acl_graphs = tags_check_acl_by_module($module['id'], $config['id_user'], 'RR') === true;
|
||||
}
|
||||
else {
|
||||
$acl_graphs = check_acl($config['id_user'], $group_id, "RR");
|
||||
}
|
||||
}
|
||||
else if (!empty($group_id)) {
|
||||
$acl_graphs = true;
|
||||
}
|
||||
|
||||
if ($acl_graphs) {
|
||||
$module["showGraphs"] = 1;
|
||||
}
|
||||
|
||||
if ($module["showGraphs"]) {
|
||||
|
|
|
@ -2046,7 +2046,20 @@ function events_page_details ($event, $server = "") {
|
|||
}
|
||||
$table_details->data[] = $data;
|
||||
|
||||
if (check_acl($config['id_user'], $agent['id_grupo'], "RR")) {
|
||||
// ACL
|
||||
$acl_graph = false;
|
||||
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||
|
||||
if (!empty($agent['id_grupo'])) {
|
||||
if ($strict_user) {
|
||||
$acl_graph = tags_check_acl_by_module($module["id_agente_modulo"], $config['id_user'], 'RR') === true;
|
||||
}
|
||||
else {
|
||||
$acl_graph = check_acl($config['id_user'], $agent['id_grupo'], "RR");
|
||||
}
|
||||
}
|
||||
|
||||
if ($acl_graph) {
|
||||
$data = array();
|
||||
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Graph').'</div>';
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ require_once ($config['homedir'] . '/include/functions_reporting.php');
|
|||
require_once ($config['homedir'] . '/include/functions_graph.php');
|
||||
require_once ($config['homedir'] . '/include/functions_modules.php');
|
||||
require_once ($config['homedir'] . '/include/functions_agents.php');
|
||||
require_once ($config['homedir'] . '/include/functions_tags.php');
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -112,9 +113,15 @@ $label = base64_decode(get_parameter('label', ''));
|
|||
// ACL
|
||||
$permission = false;
|
||||
$agent_group = (int) agents_get_agent_group($agent_id);
|
||||
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||
|
||||
if (!empty($agent_group) && check_acl($config['id_user'], $agent_group, "RR")) {
|
||||
$permission = true;
|
||||
if (!empty($agent_group)) {
|
||||
if ($strict_user) {
|
||||
$permission = tags_check_acl_by_module($id, $config['id_user'], 'RR') === true;
|
||||
}
|
||||
else {
|
||||
$permission = check_acl($config['id_user'], $agent_group, "RR");
|
||||
}
|
||||
}
|
||||
|
||||
if (!$permission) {
|
||||
|
|
|
@ -1197,7 +1197,22 @@ foreach ($result as $row) {
|
|||
|
||||
$data[7] = "";
|
||||
|
||||
if ($row['history_data'] == 1 && check_acl($config['id_user'], $row['id_group'], "RR")) {
|
||||
$acl_graphs = false;
|
||||
|
||||
// Avoid the check on the metaconsole. Too slow to show/hide an icon depending on the permissions
|
||||
if (!defined("METACONSOLE")) {
|
||||
if ($strict_user) {
|
||||
$acl_graphs = tags_check_acl_by_module($row['id_agente_modulo'], $config['id_user'], 'RR') === true;
|
||||
}
|
||||
else {
|
||||
$acl_graphs = check_acl($config['id_user'], $row['id_group'], "RR");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$acl_graphs = true;
|
||||
}
|
||||
|
||||
if ($row['history_data'] == 1 && $acl_graphs) {
|
||||
|
||||
$graph_type = return_graphtype ($row["module_type"]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue