. */ namespace SP\Modules\Web\Controllers\Helpers\Account; use SP\Domain\Account\Adapters\AccountPermission; use SP\Domain\Account\Dtos\AccountEnrichedDto; use SP\Domain\Common\Services\ServiceException; use SP\Domain\Core\Acl\UnauthorizedPageException; use SP\Domain\User\Services\UpdatedMasterPassException; use SP\Infrastructure\Common\Repositories\NoSuchItemException; /** * Class AccountRequestHelper */ final class AccountRequestHelper extends AccountHelperBase { /** * Sets account's view variables * * @param AccountEnrichedDto $accountDetailsResponse * @param int $actionId * * @return bool * @throws UnauthorizedPageException * @throws NoSuchItemException * @throws ServiceException * @throws UpdatedMasterPassException */ public function setViewForRequest( AccountEnrichedDto $accountDetailsResponse, int $actionId ): bool { $this->accountId = $accountDetailsResponse->getAccountDataView()->getId(); $this->actionId = $actionId; $this->accountAcl = new AccountPermission($actionId); $this->checkActionAccess(); $accountData = $accountDetailsResponse->getAccountDataView(); $this->view->assign('accountId', $accountData->getId()); $this->view->assign('accountData', $accountDetailsResponse->getAccountDataView()); $this->view->assign( 'accountActions', $this->accountActionsHelper->getActionsForAccount( $this->accountAcl, new AccountActionsDto( $this->accountId, null, $accountData->getParentId() ) ) ); return true; } }