This commit is contained in:
2023-12-14 20:29:39 +05:00
parent 382317f1ae
commit 84bcc2e517
3 changed files with 11 additions and 2 deletions

View File

@@ -56,6 +56,7 @@ class AuthServiceProvider extends ServiceProvider
{
// General permissions...
Gate::define('isMe', fn ($user) => $user->isMe());
Gate::define('isSuperAdmin', fn ($user) => $user->isSuperAdmin());
Gate::define('isAdmin', fn ($user) => $user->isAdmin());
Gate::define('systemUser', fn ($user) => $user->isSystemUser());

View File

@@ -98,7 +98,7 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
->onSwitchLocale(NovaRepo::localeSwitcherSave()),
BackupTool::make()
->canSee(NovaRepo::isAdmin()),
->canSee(NovaRepo::isSuperAdmin()),
LogsTool::make()
->canSee(NovaRepo::isMe())

View File

@@ -86,7 +86,15 @@ class NovaRepo
/**
* Check if user is admin
*/
public function isAdmin(): Closure
public static function isSuperAdmin(): Closure
{
return fn () => Gate::allows('isSuperAdmin', auth()->user());
}
/**
* Check if user is admin
*/
public static function isAdmin(): Closure
{
return fn () => Gate::allows('isAdmin', auth()->user());
}