Skip to content

Commit 00248c4

Browse files
committed
Added option to disable EditLocally menu option
Signed-off-by: Konstantin Myakshin <[email protected]>
1 parent 5d669ab commit 00248c4

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

apps/files/lib/Controller/ViewController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal
280280
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
281281

282282
$params = [
283-
'fileNotFound' => $fileNotFound ? 1 : 0
283+
'fileNotFound' => $fileNotFound ? 1 : 0,
284+
'disableEditLocally' => $this->config->getSystemValueBool('disable_edit_locally') ? 1 : 0,
284285
];
285286

286287
$response = new TemplateResponse(

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']); ?>" />

apps/files/tests/Controller/ViewControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function testIndexWithRegularBrowser() {
168168
[$this->user->getUID(), 'files', 'crop_image_previews', true, true],
169169
[$this->user->getUID(), 'files', 'show_grid', true],
170170
]);
171-
171+
172172
$baseFolderFiles = $this->getMockBuilder(Folder::class)->getMock();
173173

174174
$this->rootFolder->expects($this->any())
@@ -186,6 +186,7 @@ public function testIndexWithRegularBrowser() {
186186
'index',
187187
[
188188
'fileNotFound' => 0,
189+
'disableEditLocally' => 0,
189190
]
190191
);
191192
$policy = new Http\ContentSecurityPolicy();

0 commit comments

Comments
 (0)