[Pandora Console > Mobile] Added support to the user's default page

This commit is contained in:
Alejandro Gallardo Escobar 2017-11-17 12:29:52 +01:00
parent 215d3c005f
commit b6470a0e98
3 changed files with 70 additions and 2 deletions

View File

@ -328,5 +328,9 @@ class User {
public function getIdGroups ($access = "AR", $all = false) { public function getIdGroups ($access = "AR", $all = false) {
return array_keys(users_get_groups($this->user, $access, $all)); return array_keys(users_get_groups($this->user, $access, $all));
} }
public function getInfo () {
return users_get_user_by_id($this->user);
}
} }
?> ?>

View File

@ -84,7 +84,8 @@ if (!is_object($user) && gettype($user) == 'object') {
$user->saveLogin(); $user->saveLogin();
$page = $system->getRequest('page', 'home'); $default_page = 'home';
$page = $system->getRequest('page');
$action = $system->getRequest('action'); $action = $system->getRequest('action');
// The logout action has priority // The logout action has priority
@ -242,7 +243,7 @@ switch ($action) {
default: default:
if (class_exists("Enterprise")) { if (class_exists("Enterprise")) {
$enterprise = Enterprise::getInstance(); $enterprise = Enterprise::getInstance();
if ($page != "home") { if (!empty($page) && $page != $default_page) {
$permission = $enterprise->checkEnterpriseACL($page); $permission = $enterprise->checkEnterpriseACL($page);
if (!$permission) { if (!$permission) {
@ -259,6 +260,36 @@ switch ($action) {
} }
} }
} }
if (empty($page)) {
$user_info = $user->getInfo();
$home_page = $system->safeOutput($user_info['section']);
$section_data = $user_info['data_section'];
switch ($home_page) {
case 'Event list':
$page = 'events';
break;
case 'Group view':
break;
case 'Alert detail':
$page = 'alerts';
break;
case 'Tactical view':
$page = 'tactical';
break;
case 'Dashboard':
$page = 'dashboard';
$id_dashboard = (int) db_get_value('id', 'tdashboard', 'name', $section_data);
$_GET['id_dashboard'] = $id_dashboard;
break;
case 'Visual console':
$page = 'visualmap';
$id_map = (int) db_get_value('id', 'tlayout', 'name', $section_data);
$_GET['id'] = $id_map;
break;
}
}
switch ($page) { switch ($page) {
case 'home': case 'home':

View File

@ -54,6 +54,13 @@ class Home {
); );
if (!$system->getConfig('metaconsole')) { if (!$system->getConfig('metaconsole')) {
$items['alerts'] = array(
'name' => __('Alerts'),
'filename' => 'alerts.php',
'menu_item' => true,
'icon' => 'alerts'
);
$items['agents'] = array( $items['agents'] = array(
'name' => __('Agents'), 'name' => __('Agents'),
'filename' => 'agents.php', 'filename' => 'agents.php',
@ -67,6 +74,19 @@ class Home {
'icon' => 'modules' 'icon' => 'modules'
); );
$items['networkmaps'] = array(
'name' => __('Networkmaps'),
'filename' => 'networkmaps.php',
'menu_item' => true,
'icon' => 'network_maps'
);
$items['visualmaps'] = array(
'name' => __('Visual consoles'),
'filename' => 'visualmaps.php',
'menu_item' => true,
'icon' => 'visual_console'
);
// Not in home // Not in home
$items['agent'] = array( $items['agent'] = array(
'name' => __('Agent'), 'name' => __('Agent'),
@ -80,6 +100,19 @@ class Home {
'menu_item' => false, 'menu_item' => false,
'icon' => '' 'icon' => ''
); );
$items['networkmap'] = array(
'name' => __('Networkmap'),
'filename' => 'networkmap.php',
'menu_item' => false,
'icon' => ''
);
$items['visualmap'] = array(
'name' => __('Visualmap'),
'filename' => 'visualmap.php',
'menu_item' => false,
'icon' => ''
);
} }
$this->pagesItems = $items; $this->pagesItems = $items;