Add role-based access control to management pages: implement canView method in ManageCtaSettings, ManagePortfolio, ManageSolutions, and ManageSuccess classes to restrict access to ADMIN and MANAGER roles, enhancing security and user experience.
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\CtaSettings;
|
||||
use App\Models\UserRole;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\SettingsPage;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class ManageCtaSettings extends SettingsPage
|
||||
{
|
||||
@@ -42,4 +44,9 @@ class ManageCtaSettings extends SettingsPage
|
||||
->columnSpan('full'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function canView(): bool
|
||||
{
|
||||
return auth()->user()->role === UserRole::ADMIN || auth()->user()->role === UserRole::MANAGER;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user