Roles via Nextcloud groups: sms-admin/manager/viewer + fix OAuth instance_uri
Deploy / deploy (push) Successful in 29s
Deploy / deploy (push) Successful in 29s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
fc4579c47d
commit
2937004118
16 files changed
+506
-5
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
trait EnforcesRoles
|
||||
{
|
||||
private static function canWrite(): bool
|
||||
{
|
||||
return auth()->user()?->hasAnyRole(['sms-admin', 'sms-manager']) ?? false;
|
||||
}
|
||||
|
||||
public static function canCreate(): bool
|
||||
{
|
||||
return static::canWrite();
|
||||
}
|
||||
|
||||
public static function canEdit(Model $record): bool
|
||||
{
|
||||
return static::canWrite();
|
||||
}
|
||||
|
||||
public static function canDelete(Model $record): bool
|
||||
{
|
||||
return static::canWrite();
|
||||
}
|
||||
|
||||
public static function canDeleteAny(): bool
|
||||
{
|
||||
return static::canWrite();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user