Skip to content

Commit

Permalink
Add role permission for health page (#878)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy132 authored Jan 6, 2025
1 parent 7f37b3b commit 448fe41
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/Filament/Admin/Pages/Health.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class Health extends Page
'refresh-component' => '$refresh',
];

public static function canAccess(): bool
{
return auth()->user()->can('view health');
}

protected function getActions(): array
{
return [
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Admin/Resources/RoleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private static function makeSection(string $model, array $options): Section
$icon = ('\App\Filament\Server\Resources\\' . $model . 'Resource')::getNavigationIcon();
}

return Section::make(Str::headline(Str::plural($model)))
return Section::make(Str::headline($model))
->columnSpan(1)
->collapsible()
->collapsed()
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class Role extends BaseRole
'view',
'update',
],
'health' => [
'view',
],
'activity' => [
'seeIps',
],
Expand Down

0 comments on commit 448fe41

Please sign in to comment.