Skip to content

Commit 156b160

Browse files
committed
Added option to disable EditLocally menu option
Signed-off-by: Konstantin Myakshin <molodchick@gmail.com>
1 parent 1137b7a commit 156b160

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

apps/files/lib/Controller/ViewController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function showFile(string $fileid = null): Response {
172172
* @NoCSRFRequired
173173
* @NoAdminRequired
174174
* @UseSession
175-
*
175+
*
176176
* @param string $dir
177177
* @param string $view
178178
* @param string $fileid
@@ -259,7 +259,8 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal
259259
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
260260

261261
$params = [
262-
'fileNotFound' => $fileNotFound ? 1 : 0
262+
'fileNotFound' => $fileNotFound ? 1 : 0,
263+
'disableEditLocally' => $this->config->getSystemValueString('disable_edit_locally', 0),
263264
];
264265

265266
$response = new TemplateResponse(
@@ -392,7 +393,7 @@ private function redirectToFile(int $fileId) {
392393
}
393394
return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.indexViewFileid', $params));
394395
}
395-
396+
396397
throw new NotFoundException();
397398
}
398399
}

apps/files/src/actions/editLocallyAction.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export const action = new FileAction({
5151

5252
// Only works on single files
5353
enabled(nodes: Node[]) {
54+
if ($('#disableEditLocally').val() === "1") {
55+
return false
56+
}
57+
5458
// Only works on single node
5559
if (nodes.length !== 1) {
5660
return false

apps/files/templates/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
<!-- config hints for javascript -->
88
<input type="hidden" name="filesApp" id="filesApp" value="1" />
99
<input type="hidden" name="fileNotFound" id="fileNotFound" value="<?php p($_['fileNotFound']); ?>" />
10+
<input type="hidden" name="disableEditLocally" id="disableEditLocally" value="<?php p($_['disableEditLocally']); ?>" />

0 commit comments

Comments
 (0)