Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-06-21 15:46:27 +0300
committerJulius Härtl <jus@bitgrid.net>2019-06-21 15:46:27 +0300
commitd4a82113a05fd2d2ab4f9e2117878b631453d4a0 (patch)
treec06a1f687477018ae4ddf6fb1662010e5a1f9781 /lib
parentab93b53a3cf6dc872154139270d7bf2f58a721a3 (diff)
Implement public folder editing (fixes #29)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/ApiService.php12
-rw-r--r--lib/Service/DocumentService.php4
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php
index c24ba7936..83a7a8124 100644
--- a/lib/Service/ApiService.php
+++ b/lib/Service/ApiService.php
@@ -39,6 +39,7 @@ use OCP\Constants;
use OCP\Files\NotFoundException;
use OCP\ICacheFactory;
use OCP\ILogger;
+use OCP\IRequest;
use OCP\Lock\LockedException;
class ApiService {
@@ -48,7 +49,8 @@ class ApiService {
protected $documentService;
protected $logger;
- public function __construct(ICacheFactory $cacheFactory, SessionService $sessionService, DocumentService $documentService, ILogger $logger) {
+ public function __construct(IRequest $request, ICacheFactory $cacheFactory, SessionService $sessionService, DocumentService $documentService, ILogger $logger) {
+ $this->request = $request;
$this->cache = $cacheFactory->createDistributed('textSession');
$this->sessionService = $sessionService;
$this->documentService = $documentService;
@@ -61,7 +63,7 @@ class ApiService {
/** @var File $file */
$file = null;
if ($token) {
- $file = $this->documentService->getFileByShareToken($token, $filePath);
+ $file = $this->documentService->getFileByShareToken($token, $this->request->getParam('filePath'));
try {
$this->documentService->checkSharePermissions($token, Constants::PERMISSION_UPDATE);
$readOnly = false;
@@ -131,7 +133,7 @@ class ApiService {
*/
public function push($documentId, $sessionId, $sessionToken, $version, $steps, $token = null): DataResponse {
if ($token) {
- $file = $this->documentService->getFileByShareToken($token);
+ $file = $this->documentService->getFileByShareToken($token, $this->request->getParam('filePath'));
} else {
$file = $this->documentService->getFileById($documentId);
}
@@ -161,12 +163,12 @@ class ApiService {
];
try {
- $result['document'] = $this->documentService->autosave($documentId, $version, $autosaveContent, $force, $manualSave, $token);
+ $result['document'] = $this->documentService->autosave($documentId, $version, $autosaveContent, $force, $manualSave, $token, $this->request->getParam('filePath'));
} catch (DocumentSaveConflictException $e) {
try {
if ($token) {
/** @var File $file */
- $file = $this->documentService->getFileByShareToken($token);
+ $file = $this->documentService->getFileByShareToken($token, $this->request->getParam('filePath'));
} else {
$file = $this->documentService->getFileById($documentId);
}
diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php
index e35898f77..f27b1c5ed 100644
--- a/lib/Service/DocumentService.php
+++ b/lib/Service/DocumentService.php
@@ -225,7 +225,7 @@ class DocumentService {
* @throws NotPermittedException
* @throws ShareNotFound
*/
- public function autosave($documentId, $version, $autoaveDocument, $force = false, $manualSave = false, $token = null): Document {
+ public function autosave($documentId, $version, $autoaveDocument, $force = false, $manualSave = false, $token = null, $filePath = null): Document {
/** @var Document $document */
$document = $this->documentMapper->find($documentId);
@@ -233,7 +233,7 @@ class DocumentService {
if (!$token) {
$file = $this->getFileById($documentId);
} else {
- $file = $this->getFileByShareToken($token);
+ $file = $this->getFileByShareToken($token, $filePath);
}
if ($this->isReadOnly($file, $token)) {