Modified the view to restrict some controls when the strict ACL is enabled

This commit is contained in:
Alejandro Gallardo Escobar 2015-01-30 20:41:54 +01:00
parent 4cf9accbd7
commit f6e31d4a17

View File

@ -23,6 +23,8 @@ $status_agent = get_parameter('statusAgent', AGENT_STATUS_ALL);
$search_module = get_parameter('searchModule', ''); $search_module = get_parameter('searchModule', '');
$status_module = get_parameter('statusModule', -1); $status_module = get_parameter('statusModule', -1);
$strict_acl = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
// ---------------------Tabs ------------------------------------------- // ---------------------Tabs -------------------------------------------
$enterpriseEnable = false; $enterpriseEnable = false;
if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT_HOOK) { if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT_HOOK) {
@ -38,71 +40,82 @@ $url = 'index.php?' .
$tabs = array(); $tabs = array();
$tabs['tag'] = array( if (!$strict_acl) {
'text' => "<a href='" . sprintf($url, "tag") . "'>" . $tabs['tag'] = array(
html_print_image("images/tag.png", true, 'text' => "<a href='" . sprintf($url, "tag") . "'>" .
array("title" => __('Tags'))) . "</a>", html_print_image("images/tag.png", true,
'active' => ($tab == "tag")); array("title" => __('Tags'))) . "</a>",
'active' => ($tab == "tag"));
$tabs['os'] = array( $tabs['os'] = array(
'text' => "<a href='" . sprintf($url, "os") . "'>" . 'text' => "<a href='" . sprintf($url, "os") . "'>" .
html_print_image("images/operating_system.png", true, html_print_image("images/operating_system.png", true,
array("title" => __('OS'))) . "</a>", array("title" => __('OS'))) . "</a>",
'active' => ($tab == "os")); 'active' => ($tab == "os"));
$tabs['group'] = array( $tabs['group'] = array(
'text' => "<a href='" . sprintf($url, "group") . "'>" . 'text' => "<a href='" . sprintf($url, "group") . "'>" .
html_print_image("images/group.png", true, html_print_image("images/group.png", true,
array("title" => __('Groups'))) . "</a>", array("title" => __('Groups'))) . "</a>",
'active' => ($tab == "group")); 'active' => ($tab == "group"));
$tabs['module_group'] = array( $tabs['module_group'] = array(
'text' => "<a href='" . sprintf($url, "module_group") . "'>" . 'text' => "<a href='" . sprintf($url, "module_group") . "'>" .
html_print_image("images/module_group.png", true, html_print_image("images/module_group.png", true,
array("title" => __('Module groups'))) . "</a>", array("title" => __('Module groups'))) . "</a>",
'active' => ($tab == "module_group")); 'active' => ($tab == "module_group"));
$tabs['module'] = array( $tabs['module'] = array(
'text' => "<a href='" . sprintf($url, "module") . "'>" . 'text' => "<a href='" . sprintf($url, "module") . "'>" .
html_print_image("images/brick.png", true, html_print_image("images/brick.png", true,
array("title" => __('Modules'))) . "</a>", array("title" => __('Modules'))) . "</a>",
'active' => ($tab == "module")); 'active' => ($tab == "module"));
if ($enterpriseEnable) { if ($enterpriseEnable) {
$tabs['policies'] = array( $tabs['policies'] = array(
'text' => "<a href='" . sprintf($url, "policies") . "'>" . 'text' => "<a href='" . sprintf($url, "policies") . "'>" .
html_print_image("images/policies_mc.png", true, html_print_image("images/policies_mc.png", true,
array("title" => __('Policies'))) . "</a>", array("title" => __('Policies'))) . "</a>",
'active' => ($tab == "policies")); 'active' => ($tab == "policies"));
}
} }
$header_title = __('Tree view') . " - " . __('Sort the agents by %s'); $header_title = __('Tree view');
$header_sub_title = __('Sort the agents by %s');
switch ($tab) { switch ($tab) {
case 'tag': case 'tag':
$header_title = sprintf($header_title, __('tags')); $header_sub_title = sprintf($header_sub_title, __('tags'));
break; break;
case 'os': case 'os':
$header_title = sprintf($header_title, __('OS')); $header_sub_title = sprintf($header_sub_title, __('OS'));
break; break;
case 'group': case 'group':
$header_title = sprintf($header_title, __('groups')); $header_sub_title = sprintf($header_sub_title, __('groups'));
break; break;
case 'module_group': case 'module_group':
$header_title = sprintf($header_title, __('module groups')); $header_sub_title = sprintf($header_sub_title, __('module groups'));
break; break;
case 'module': case 'module':
$header_title = sprintf($header_title, __('modules')); $header_sub_title = sprintf($header_sub_title, __('modules'));
break; break;
case 'policies': case 'policies':
if ($enterpriseEnable) if ($enterpriseEnable)
$header_title = sprintf($header_title, __('policies')); $header_sub_title = sprintf($header_sub_title, __('policies'));
break; break;
} }
if (defined('METACONSOLE')) if (defined('METACONSOLE')) {
ui_meta_print_header($header_title, "", $tabs); if ($strict_acl)
else $header_sub_title = '';
ui_meta_print_header($header_title, $header_sub_title, $tabs);
}
else{
if (!$strict_acl)
$header_title = $header_title ." - ". $header_sub_title;
ui_print_page_header($header_title, "images/extensions.png", false, "", false, $tabs); ui_print_page_header($header_title, "images/extensions.png", false, "", false, $tabs);
}
// ---------------------Tabs ------------------------------------------- // ---------------------Tabs -------------------------------------------
@ -128,8 +141,8 @@ else {
} }
// --------------------- form filter ----------------------------------- // --------------------- form filter -----------------------------------
$table = new StdClass(); $table = new StdClass();
// $table->class = "blank";
$table->width = "100%"; $table->width = "100%";
$table->data = array(); $table->data = array();
$table->rowspan = array(); $table->rowspan = array();
@ -174,9 +187,11 @@ $table->data[] = $row;
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
echo '<form id="tree_search" method="post" action="index.php?sec=monitoring&sec2=operation/tree&refr=0&tab='.$tab.'&pure='.$config['pure'].'">'; if (!$strict_acl) {
html_print_table($table); echo '<form id="tree_search" method="post" action="index.php?sec=monitoring&sec2=operation/tree&refr=0&tab='.$tab.'&pure='.$config['pure'].'">';
echo '</form>'; html_print_table($table);
echo '</form>';
}
// --------------------- form filter ----------------------------------- // --------------------- form filter -----------------------------------
ui_include_time_picker(); ui_include_time_picker();