Skip to content

Commit 1654c1b

Browse files
author
Kristan Kenney
committed
Unset userContext and apply permissions if changed while logged in
1 parent ceb6793 commit 1654c1b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

web/inc/main.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ function top_panel($user, $TAB) {
161161
header("Location: /login/");
162162
}
163163

164+
// Reset user permissions if changed while logged in
165+
if (($panel[$user]['ROLE']) !== ($_SESSION['userContext']) && (!isset($_SESSION['look']))) {
166+
unset($_SESSION['userContext']);
167+
$_SESSION['userContext'] = $panel[$user]['ROLE'];
168+
}
169+
164170
// Load user's selected theme and do not change it when impersonting user
165171
if ( (isset($panel[$user]['THEME'])) && (!isset($_SESSION['look']) )) {
166172
$_SESSION['userTheme'] = $panel[$user]['THEME'];

0 commit comments

Comments
 (0)