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',
'2023.10.19',
[
'requires' => [['core', '2.28']],
'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'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',
'requires' => [['core', '2.28']],
'permissions' => 'My',
'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'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
{
// Only backend and super admin
return $context === self::INSTALL ? null : App::task()->checkContext('BACKEND') && App::auth()->isSuperAdmin();
// Limit to super admin
return match ($context) {
self::MODULE => App::auth()->isSuperAdmin(),
default => null,
};
}
}