mdn-backend / app /Domain /Files /FileAccessPolicy.php
internationalscholarsprogram's picture
feat(membership): admin-driven account creation, real estate tier/investment work, in-progress monorepo migration state
b2dcf0f
Raw
History Blame Contribute Delete
523 Bytes
<?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);
}
}