summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-01-16 18:42:58 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-01-16 22:07:51 +0100
commiteb4c42d3d1fda02895d35a360bceb08379f328c2 (patch)
treef4ded9fe2fee232f0b44f0ce94c8b45bf4a253ae /apps/files_sharing
parentfa966ebaf1f6584b927c75f3410af29885743c48 (diff)
downloadnextcloud-server-eb4c42d3d1fda02895d35a360bceb08379f328c2.tar.gz
nextcloud-server-eb4c42d3d1fda02895d35a360bceb08379f328c2.zip
Make auto accepting the default and provide setting to enforce the share acceptance process
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php5
-rw-r--r--apps/files_sharing/lib/Settings/Personal.php7
-rw-r--r--apps/files_sharing/src/components/PersonalSettings.vue8
3 files changed, 12 insertions, 8 deletions
diff --git a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php
index f8ce4353c13..382f0b61793 100644
--- a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php
+++ b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php
@@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OCA\Files_Sharing\Listener;
+use OCA\Files_Sharing\AppInfo\Application;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\IConfig;
@@ -74,7 +75,9 @@ class UserShareAcceptanceListener implements IEventListener {
}
private function handleAutoAccept(IShare $share, string $userId) {
- if ($this->config->getUserValue($userId, 'files_sharing','default_accept','no') === 'yes') {
+ $defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
+ $acceptDefault = $this->config->getUserValue($userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
+ if (!$this->config->getSystemValueBool('sharing.force_share_accept', false) && $acceptDefault) {
$this->shareManager->acceptShare($share, $userId);
}
}
diff --git a/apps/files_sharing/lib/Settings/Personal.php b/apps/files_sharing/lib/Settings/Personal.php
index 25740d8b4f0..d6fd7f5f9ca 100644
--- a/apps/files_sharing/lib/Settings/Personal.php
+++ b/apps/files_sharing/lib/Settings/Personal.php
@@ -48,8 +48,11 @@ class Personal implements ISettings {
}
public function getForm(): TemplateResponse {
- $value = $this->config->getUserValue($this->userId, Application::APP_ID, 'default_accept', 'no') === 'yes';
- $this->initialState->provideInitialState(Application::APP_ID, 'accept_default', $value);
+ $defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
+ $acceptDefault = $this->config->getUserValue($this->userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
+ $enforceAccept = $this->config->getSystemValueBool('sharing.force_share_accept', false);
+ $this->initialState->provideInitialState(Application::APP_ID, 'accept_default', $acceptDefault);
+ $this->initialState->provideInitialState(Application::APP_ID, 'enforce_accept', $enforceAccept);
return new TemplateResponse('files_sharing', 'Settings/personal');
}
diff --git a/apps/files_sharing/src/components/PersonalSettings.vue b/apps/files_sharing/src/components/PersonalSettings.vue
index b6cbbc180b6..ec7255480eb 100644
--- a/apps/files_sharing/src/components/PersonalSettings.vue
+++ b/apps/files_sharing/src/components/PersonalSettings.vue
@@ -20,7 +20,7 @@
-->
<template>
- <div id="files-sharing-personal-settings" class="section">
+ <div id="files-sharing-personal-settings" class="section" v-if="!enforceAcceptShares">
<h2>{{ t('files', 'Sharing') }}</h2>
<p>
<input id="files-sharing-personal-settings-accept"
@@ -42,12 +42,10 @@ export default {
name: 'PersonalSettings',
data() {
return {
- accepting: true,
+ accepting: loadState('files_sharing', 'accept_default'),
+ enforceAcceptShares: loadState('files_sharing', 'enforce_accept'),
}
},
- mounted() {
- this.accepting = loadState('files_sharing', 'accept_default')
- },
methods: {
toggleEnabled() {
axios.put(