From b6470a0e98375ee02eaeace36040746d59ef12bf Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 17 Nov 2017 12:29:52 +0100 Subject: [PATCH] [Pandora Console > Mobile] Added support to the user's default page --- pandora_console/mobile/include/user.class.php | 4 +++ pandora_console/mobile/index.php | 35 +++++++++++++++++-- pandora_console/mobile/operation/home.php | 33 +++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/pandora_console/mobile/include/user.class.php b/pandora_console/mobile/include/user.class.php index f0f575d3da..2c22a355e7 100644 --- a/pandora_console/mobile/include/user.class.php +++ b/pandora_console/mobile/include/user.class.php @@ -328,5 +328,9 @@ class User { public function getIdGroups ($access = "AR", $all = false) { return array_keys(users_get_groups($this->user, $access, $all)); } + + public function getInfo () { + return users_get_user_by_id($this->user); + } } ?> diff --git a/pandora_console/mobile/index.php b/pandora_console/mobile/index.php index 8fd2f0da32..582266d72f 100644 --- a/pandora_console/mobile/index.php +++ b/pandora_console/mobile/index.php @@ -84,7 +84,8 @@ if (!is_object($user) && gettype($user) == 'object') { $user->saveLogin(); -$page = $system->getRequest('page', 'home'); +$default_page = 'home'; +$page = $system->getRequest('page'); $action = $system->getRequest('action'); // The logout action has priority @@ -242,7 +243,7 @@ switch ($action) { default: if (class_exists("Enterprise")) { $enterprise = Enterprise::getInstance(); - if ($page != "home") { + if (!empty($page) && $page != $default_page) { $permission = $enterprise->checkEnterpriseACL($page); 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) { case 'home': diff --git a/pandora_console/mobile/operation/home.php b/pandora_console/mobile/operation/home.php index 85e487294b..59728010a5 100644 --- a/pandora_console/mobile/operation/home.php +++ b/pandora_console/mobile/operation/home.php @@ -54,6 +54,13 @@ class Home { ); if (!$system->getConfig('metaconsole')) { + $items['alerts'] = array( + 'name' => __('Alerts'), + 'filename' => 'alerts.php', + 'menu_item' => true, + 'icon' => 'alerts' + ); + $items['agents'] = array( 'name' => __('Agents'), 'filename' => 'agents.php', @@ -67,6 +74,19 @@ class Home { '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 $items['agent'] = array( 'name' => __('Agent'), @@ -80,6 +100,19 @@ class Home { 'menu_item' => false, '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;