mdn-backend / app /Domain /Applications /ApplicationWorkflowPolicy.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
583 Bytes
<?php
namespace App\Domain\Applications;
use App\Domain\Identity\RbacService;
class ApplicationWorkflowPolicy
{
public function __construct(private readonly RbacService $rbac)
{
}
public function canAccess(object $application, string $actorUserId): bool
{
return $application->user_id === $actorUserId || $this->canManage($actorUserId);
}
public function canManage(string $actorUserId): bool
{
return $this->rbac->can($actorUserId, 'SYSTEM_CONFIGURE')
|| $this->rbac->can($actorUserId, 'SYSTEM_ADMIN_ACCESS');
}
}