Skip to content

Commit 1cf1b92

Browse files
committed
do not show dashboard if not available/allowed
(cherry picked from commit 690eab8)
1 parent eb7ca74 commit 1cf1b92

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

Diff for: web/auth_login.php

+24-5
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,37 @@
5555
$_SESSION['user_tabs'] = $_SESSION['temp_user_tabs'];
5656
$_SESSION['user_priv'] = $_SESSION['temp_user_priv'];
5757

58+
59+
$dashboard = false;
60+
$default_path = NULL;
5861
foreach ($config_modules as $menuitem => $menuitem_config) {
5962
if (!$menuitem_config['enabled'])
6063
continue;
6164
if (!isset($menuitem_config['modules']))
6265
continue;
6366
if (isset($menuitem_config['modules']['dashboard'])
64-
&& $menuitem_config['modules']['dashboard']['enabled'])
67+
&& $menuitem_config['modules']['dashboard']['enabled']
68+
&& ($avail_tools == "all" || array_key_exists("dashboard", explode(",",$avail_tools))))
6569
$dashboard = true;
66-
else $dashboard = false;
70+
foreach ($menuitem_config['modules'] as $module => $values) {
71+
if (isset($values['enabled']) && !$values['enabled'])
72+
continue;
73+
if (isset($values['default']) && $values['default']) {
74+
$default_path = 'tools/';
75+
if (!isset($value['path']))
76+
$default_path .= $menuitem . '/' . $module;
77+
else
78+
$default_path .= $value['path'];
79+
$default_path .= '/index.php';
80+
if (!file_exists($default_path))
81+
$default_path = NULL;
82+
}
83+
}
6784
}
68-
69-
if ($dashboard) {
85+
86+
if ($default_path != NULL) {
87+
$_SESSION['path'] = $default_path;
88+
} else if ($dashboard) {
7089
$query = "SELECT COUNT(*) as panel_no FROM ocp_dashboard;";
7190
$stmt = $link->prepare($query);
7291
if (!$stmt->execute(array($name))) {
@@ -83,4 +102,4 @@
83102
print_r("Incorrect code");
84103
die;
85104
}
86-
?>
105+
?>

Diff for: web/login.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@
177177
if (!isset($menuitem_config['modules']))
178178
continue;
179179
if (isset($menuitem_config['modules']['dashboard'])
180-
&& $menuitem_config['modules']['dashboard']['enabled'])
180+
&& $menuitem_config['modules']['dashboard']['enabled']
181+
&& ($avail_tools == "all" || array_key_exists("dashboard", explode(",",$avail_tools))))
181182
$dashboard = true;
182183
foreach ($menuitem_config['modules'] as $module => $values) {
183184
if (isset($values['enabled']) && !$values['enabled'])

0 commit comments

Comments
 (0)