maybe better permissions check

This commit is contained in:
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

@ -19,10 +19,11 @@ $this->registerModule(
'Jean-Christian Denis', 'Jean-Christian Denis',
'2023.10.19', '2023.10.19',
[ [
'requires' => [['core', '2.28']], 'requires' => [['core', '2.28']],
'type' => 'plugin', 'permissions' => 'My',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', 'type' => 'plugin',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml', 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
] ]
); );

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,
};
} }
} }