getUser()->isAdmin(); } public function postActionGetFolders(Request $request): array { $data = $request->getParsedBody(); $params = [ 'host' => $data->host ?? null, 'port' => $data->port ?? null, 'security' => $data->security ?? null, 'username' => $data->username ?? null, 'password' => $data->password ?? null, 'id' => $data->id ?? null, ]; return $this->getInboundEmailService()->getFolders($params); } public function postActionTestConnection(Request $request): bool { $data = $request->getParsedBody(); if (is_null($data->password)) { $inboundEmail = $this->entityManager->getEntity('InboundEmail', $data->id); if (!$inboundEmail || !$inboundEmail->getId()) { throw new Error(); } $data->password = $this->crypt->decrypt($inboundEmail->get('password')); } $this->getInboundEmailService()->testConnection(get_object_vars($data)); return true; } private function getInboundEmailService(): Service { /** @var Service */ return $this->getRecordService(); } }