Files
SpiceManagementSystem/app/Traits/EnforcesRolesInRelation.php
T
Malek TellissiandClaude Sonnet 4.6 0c44bfa6d0
Deploy / deploy (push) Failing after 12s
Implement role-based access control and revert hardcoded OAuth credentials
- sms-admin: full access (create, edit, delete)
- sms-manager: create and edit only, no delete
- sms-viewer: read-only, all write buttons hidden
- Apply EnforcesRolesInRelation trait to BatchesRelationManager
- Revert Nextcloud OAuth credentials to env vars (OAUTH_CLOUDSPICESBLUE_*)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-09-13 02:03:46 +02:00

27 lines
560 B
PHP

<?php
namespace App\Traits;
trait EnforcesRolesInRelation
{
public function canCreate(): bool
{
return auth()->user()?->hasAnyRole(['sms-admin', 'sms-manager']) ?? false;
}
public function canEdit(): bool
{
return auth()->user()?->hasAnyRole(['sms-admin', 'sms-manager']) ?? false;
}
public function canDelete(): bool
{
return auth()->user()?->hasRole('sms-admin') ?? false;
}
public function canDeleteAny(): bool
{
return auth()->user()?->hasRole('sms-admin') ?? false;
}
}