Add viewer access to records and restrict activity log
Deploy / deploy (push) Successful in 16s

- canView() + canViewAny() in EnforcesRoles: all SMS roles can view
- View pages for all 7 resources so viewers can open records read-only
- Custom ActivityResource restricts activity log to admin + manager only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Malek TellissiandClaude Sonnet 4.6 committed 2026-09-13 02:44:00 +02:00
1 parent 596d66b366
commit 1494273efd
17 files changed
+106 -1

No files matched your search

+10
View File
@@ -6,6 +6,16 @@ use Illuminate\Database\Eloquent\Model;
trait EnforcesRoles
{
public static function canViewAny(): bool
{
return auth()->user()?->hasAnyRole(['sms-admin', 'sms-manager', 'sms-viewer']) ?? false;
}
public static function canView(Model $record): bool
{
return auth()->user()?->hasAnyRole(['sms-admin', 'sms-manager', 'sms-viewer']) ?? false;
}
public static function canCreate(): bool
{
return auth()->user()?->hasAnyRole(['sms-admin', 'sms-manager']) ?? false;