Merge branch 'default-mobile-page' into 'develop'

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

See merge request artica/pandorafms!1091
This commit is contained in:
vgilc 2017-12-21 10:41:24 +01:00
commit 733564dcb1
3 changed files with 70 additions and 2 deletions

View File

@ -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);
}
}
?>

View File

@ -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':

View File

@ -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;