acl->check('EmailAccountScope'); } 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, 'emailAddress' => $data->emailAddress ?? null, 'userId' => $data->userId ?? null, ]; return $this->getEmailAccountService()->getFolders($params); } public function postActionTestConnection(Request $request): bool { $data = $request->getParsedBody(); if (is_null($data->password)) { $emailAccount = $this->entityManager->getEntity('EmailAccount', $data->id); if (!$emailAccount || !$emailAccount->getId()) { throw new Error(); } if ( $emailAccount->get('assignedUserId') !== $this->user->getId() && !$this->user->isAdmin() ) { throw new Forbidden(); } $data->password = $this->crypt->decrypt($emailAccount->get('password')); } $this->getEmailAccountService()->testConnection(get_object_vars($data)); return true; } private function getEmailAccountService(): Service { /** @var Service */ return $this->getRecordService(); } }