fileUtility->getFileByToken(null, $shareToken, $path); if (isset($error)) { $this->logger->error("Federated getFileByToken: $error"); return new DataResponse(["error" => $error]); } $key = $this->fileUtility->getKey($file, true); $key = DocumentService::generateRevisionId($key); $this->logger->debug("Federated request get for " . $file->getId() . " key $key"); return new DataResponse(["key" => $key]); } /** * Lock the origin document key for editor * * @param string $shareToken - access token * @param string $path - file path * @param bool $lock - status * @param bool $fs - status * * @return DataResponse */ #[NoAdminRequired] #[NoCSRFRequired] #[PublicPage] public function keylock(string $shareToken, string $path, bool $lock, ?bool $fs): DataResponse { [$file, $error, $share] = $this->fileUtility->getFileByToken(null, $shareToken, $path); if (isset($error)) { $this->logger->error("Federated getFileByToken: $error"); return new DataResponse(["error" => $error]); } $fileId = $file->getId(); if (RemoteInstance::isRemoteFile($file)) { $isLock = RemoteInstance::lockRemoteKey($file, $lock, $fs); if (!$isLock) { return new DataResponse(["error" => "Failed request"]); } } else { $this->keyManager->lock($fileId, $lock); if (!empty($fs)) { $this->keyManager->setForcesave($fileId, $fs); } } $this->logger->debug("Federated request lock for " . $fileId); return new DataResponse(); } /** * Health check instance */ #[NoAdminRequired] #[NoCSRFRequired] #[PublicPage] public function healthcheck(): DataResponse { $this->logger->debug("Federated healthcheck"); return new DataResponse(["alive" => true]); } }