diff options
author | Simon Rettberg | 2022-06-10 12:00:55 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-06-10 12:00:55 +0200 |
commit | 72c7d213468b204a756ed96869491d4dec8e67c6 (patch) | |
tree | 87701dc45b90d214067a3162fe145dafc006b5b4 /modules-available/runmode/page.inc.php | |
parent | [rebootcontrol] Add dedicated permission to view wol/reboot/exec jobs (diff) | |
download | slx-admin-72c7d213468b204a756ed96869491d4dec8e67c6.tar.gz slx-admin-72c7d213468b204a756ed96869491d4dec8e67c6.tar.xz slx-admin-72c7d213468b204a756ed96869491d4dec8e67c6.zip |
[runmode] Show error if no permissions
Closes #3909
Diffstat (limited to 'modules-available/runmode/page.inc.php')
-rw-r--r-- | modules-available/runmode/page.inc.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules-available/runmode/page.inc.php b/modules-available/runmode/page.inc.php index a551ddc5..cceefae8 100644 --- a/modules-available/runmode/page.inc.php +++ b/modules-available/runmode/page.inc.php @@ -222,16 +222,20 @@ class Page_RunMode extends Page } $modules[$row['module']]['list'][] = $row; } + $anythingOk = false; foreach ($modules as $moduleId => $rows) { $disabled = ''; if ($onlyModule === false) { // Permissions - not required if rendering specific module, since it's been already done + // in $this->renderModule() + /** @var array{config: RunModeModuleConfig} $rows */ if (!$rows['config']->userHasPermission(null)) { if (!User::hasPermission('list-all')) continue; $disabled = 'disabled'; } // </Permissions> } + $anythingOk = true; $module = Module::get($moduleId); if ($module === false) continue; @@ -245,6 +249,9 @@ class Page_RunMode extends Page 'disabled' => $disabled, )); } + if (!empty($modules) && !$anythingOk) { + User::assertPermission('list-all'); + } } /** |