/** * @NoAdminRequired * @NoCSRFRequired * * @return JsonResponse */ public function getOwnUris() { $username = $this->userSettings->getUsername(); $password = $this->userSettings->getPassword(); $xmlrpc = new XmlRpc($username, $password); try { $ownUriList = $xmlrpc->ownUriListGet(); } catch (HttpException $exception) { if ($exception->getCode() === Http::STATUS_UNAUTHORIZED) { $this->logger->info('Fetching own Uris failed (unauthorized)', ['app' => $this->appName]); return new JSONResponse(['success' => false, 'error' => 'Authorization failed'], Http::STATUS_UNAUTHORIZED); } else { $this->logger->warn(sprintf('Fetching own Uris failed (%d: %s)', $exception->getCode(), $exception->getMessage()), ['app' => $this->appName]); return new JSONResponse(['success' => false, 'error' => $exception->getMessage()], Http::STATUS_BAD_GATEWAY); } } catch (\Exception $exception) { $this->logger->error(sprintf('Fetching own Uris failed with exception (%s)', $exception->getMessage()), ['app' => $this->appName]); return new JSONResponse(['success' => false, 'error' => $exception->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR); } $this->logger->info('Fetching own Uris successful', ['app' => $this->appName]); return new JSONResponse(['success' => true, 'ownUriList' => array_map(function ($entry) { return $entry->toJSON(); }, $ownUriList)]); }