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->getRecordService()->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->id) { throw new Error(); } if ( $emailAccount->get('assignedUserId') != $this->user->id && !$this->user->isAdmin() ) { throw new Forbidden(); } $data->password = $this->getContainer() ->get('crypt') ->decrypt($emailAccount->get('password')); } $this->getRecordService()->testConnection(get_object_vars($data)); return true; } }