Deploy / deploy (push) Failing after 12s
- 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>
29 lines
645 B
PHP
29 lines
645 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
trait EnforcesRoles
|
|
{
|
|
public static function canCreate(): bool
|
|
{
|
|
return auth()->user()?->hasAnyRole(['sms-admin', 'sms-manager']) ?? false;
|
|
}
|
|
|
|
public static function canEdit(Model $record): bool
|
|
{
|
|
return auth()->user()?->hasAnyRole(['sms-admin', 'sms-manager']) ?? false;
|
|
}
|
|
|
|
public static function canDelete(Model $record): bool
|
|
{
|
|
return auth()->user()?->hasRole('sms-admin') ?? false;
|
|
}
|
|
|
|
public static function canDeleteAny(): bool
|
|
{
|
|
return auth()->user()?->hasRole('sms-admin') ?? false;
|
|
}
|
|
}
|