. */ namespace SP\Modules\Web\Controllers\Helpers\Account; use SP\Domain\Account\Adapters\AccountPermission; use SP\Domain\Account\Dtos\AccountEnrichedDto; use SP\Domain\Core\Acl\UnauthorizedActionException; /** * Class AccountRequestHelper */ final class AccountRequestHelper extends AccountHelperBase { /** * Sets account's view variables * * @param AccountEnrichedDto $accountDetailsResponse * @return bool * @throws UnauthorizedActionException */ public function setViewForRequest(AccountEnrichedDto $accountDetailsResponse,): bool { if (!$this->actionGranted) { throw new UnauthorizedActionException(); } $accountId = $accountDetailsResponse->getAccountView()->getId(); $accountPermission = new AccountPermission($this->actionId); $accountData = $accountDetailsResponse->getAccountView(); $this->view->assign('accountId', $accountData->getId()); $this->view->assign('accountData', $accountDetailsResponse->getAccountView()); $this->view->assign( 'accountActions', $this->accountActionsHelper->getActionsForAccount( $accountPermission, new AccountActionsDto( $accountId, null, $accountData->getParentId() ) ) ); return true; } }