Spaces:
Running
Running
File size: 583 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\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');
}
}
|