Add role-based access control to various settings pages: implement canAccess method in AboutPageSettings, ContactPageSettings, HomePageSettings, ManageCtaSettings, ManagePortfolio, ManageSite, ManageSiteSocialSettings, ManageSolutions, ManageSuccess, and update User model to include canManageSettings method for enhanced security and user experience.
This commit is contained in:
1 parent
3e80ea4d5e
commit
643ccd6d9e
16 files changed
+83
-27
No files matched your search
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\SuccessSettings;
|
||||
use App\Models\UserRole;
|
||||
use App\Settings\SuccessSettings;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Grid;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
@@ -115,6 +115,11 @@ public function getSubheading(): string|Htmlable|null
|
||||
return 'Manage the success section content, including text, button, and skill bars.';
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()->canManageSettings();
|
||||
}
|
||||
|
||||
public static function canView(): bool
|
||||
{
|
||||
return auth()->user()->role === UserRole::ADMIN || auth()->user()->role === UserRole::MANAGER;
|
||||
|
||||
Reference in new issue
Block a user