maybe better permissions check

master
Jean-Christian Paul Denis 2023-10-21 22:48:54 +02:00
parent b360dc199f
commit f2a5aa0179
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 11 additions and 7 deletions

View File

@ -20,6 +20,7 @@ $this->registerModule(
'2023.10.19', '2023.10.19',
[ [
'requires' => [['core', '2.28']], 'requires' => [['core', '2.28']],
'permissions' => 'My',
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',

View File

@ -36,7 +36,10 @@ class My extends MyPlugin
public static function checkCustomContext(int $context): ?bool public static function checkCustomContext(int $context): ?bool
{ {
// Only backend and super admin // Limit to super admin
return $context === self::INSTALL ? null : App::task()->checkContext('BACKEND') && App::auth()->isSuperAdmin(); return match ($context) {
self::MODULE => App::auth()->isSuperAdmin(),
default => null,
};
} }
} }