Spaces:
Running
Running
File size: 523 Bytes
b2dcf0f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?php
namespace App\Domain\Files;
use App\Domain\Identity\RbacService;
class FileAccessPolicy
{
public function __construct(private readonly RbacService $rbac)
{
}
public function canAccess(object $file, string $actorUserId): bool
{
return $file->owner_user_id === $actorUserId
|| $this->rbac->can($actorUserId, 'SYSTEM_CONFIGURE');
}
public function canManage(object $file, string $actorUserId): bool
{
return $this->canAccess($file, $actorUserId);
}
}
|