mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
migrating tests (Application, Console and Cronjob)
This commit is contained in:
@ -23,9 +23,9 @@ class Backups extends Page implements HasSecondSubNav
|
||||
|
||||
protected static ?string $title = 'Backups';
|
||||
|
||||
public static function canAccess(): bool
|
||||
public function mount(): void
|
||||
{
|
||||
return auth()->user()?->can('viewAny', [Backup::class, static::getServerFromRoute()]) ?? false;
|
||||
$this->authorize('viewAny', [Backup::class, $this->server]);
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
|
@ -20,9 +20,9 @@ class Index extends Page implements HasSecondSubNav
|
||||
|
||||
protected static ?string $title = 'Databases';
|
||||
|
||||
public static function canAccess(): bool
|
||||
public function mount(): void
|
||||
{
|
||||
return auth()->user()?->can('viewAny', [Database::class, static::getServerFromRoute()]) ?? false;
|
||||
$this->authorize('viewAny', [Database::class, $this->server]);
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Web\Pages\Servers\Databases\Traits;
|
||||
|
||||
use App\Models\Backup;
|
||||
use App\Models\Database;
|
||||
use App\Models\DatabaseUser;
|
||||
use App\Web\Pages\Servers\Databases\Backups as Backups;
|
||||
use App\Web\Pages\Servers\Databases\Index as Databases;
|
||||
use App\Web\Pages\Servers\Databases\Users as Users;
|
||||
@ -14,21 +17,21 @@ public function getSecondSubNavigation(): array
|
||||
{
|
||||
$items = [];
|
||||
|
||||
if (Databases::canAccess()) {
|
||||
if (auth()->user()->can('viewAny', [Database::class, $this->server])) {
|
||||
$items[] = NavigationItem::make(Databases::getNavigationLabel())
|
||||
->icon('heroicon-o-circle-stack')
|
||||
->isActiveWhen(fn () => request()->routeIs(Databases::getRouteName()))
|
||||
->url(Databases::getUrl(parameters: ['server' => $this->server]));
|
||||
}
|
||||
|
||||
if (Users::canAccess()) {
|
||||
if (auth()->user()->can('viewAny', [DatabaseUser::class, $this->server])) {
|
||||
$items[] = NavigationItem::make(Users::getNavigationLabel())
|
||||
->icon('heroicon-o-users')
|
||||
->isActiveWhen(fn () => request()->routeIs(Users::getRouteName()))
|
||||
->url(Users::getUrl(parameters: ['server' => $this->server]));
|
||||
}
|
||||
|
||||
if (Backups::canAccess()) {
|
||||
if (auth()->user()->can('viewAny', [Backup::class, $this->server])) {
|
||||
$items[] = NavigationItem::make(Backups::getNavigationLabel())
|
||||
->icon('heroicon-o-cloud')
|
||||
->isActiveWhen(fn () => request()->routeIs(Backups::getRouteName()))
|
||||
|
@ -22,9 +22,9 @@ class Users extends Page implements HasSecondSubNav
|
||||
|
||||
protected static ?string $title = 'Database Users';
|
||||
|
||||
public static function canAccess(): bool
|
||||
public function mount(): void
|
||||
{
|
||||
return auth()->user()?->can('viewAny', [DatabaseUser::class, static::getServerFromRoute()]) ?? false;
|
||||
$this->authorize('viewAny', [DatabaseUser::class, $this->server]);
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
|
Reference in New Issue
Block a user