summaryrefslogtreecommitdiffstats
path: root/apps/settings
diff options
context:
space:
mode:
authorCorentin Damman <c.damman@intopix.com>2022-09-16 17:43:01 +0200
committerskjnldsv <skjnldsv@protonmail.com>2024-03-15 16:52:59 +0100
commit0fa9f3049f20ee4d573a6c615ebf9e7ecf7abdd1 (patch)
tree29110a4f03ce26db4419817aec2b2e996b22bd27 /apps/settings
parenta0913739c68d9c4263fc0a9fa7e58f4276458f45 (diff)
downloadnextcloud-server-0fa9f3049f20ee4d573a6c615ebf9e7ecf7abdd1.tar.gz
nextcloud-server-0fa9f3049f20ee4d573a6c615ebf9e7ecf7abdd1.zip
feat(files_sharing): allow to specify allowed groups to share instead of excluded groups
Relates to #3387 Signed-off-by: Corentin Damman <c.damman@intopix.com>
Diffstat (limited to 'apps/settings')
-rw-r--r--apps/settings/lib/Settings/Admin/Sharing.php2
-rw-r--r--apps/settings/src/components/AdminSettingsSharingForm.vue36
-rw-r--r--apps/settings/tests/Settings/Admin/SharingTest.php4
3 files changed, 29 insertions, 13 deletions
diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php
index fc8b811eccd..ec9dc0ddfd1 100644
--- a/apps/settings/lib/Settings/Admin/Sharing.php
+++ b/apps/settings/lib/Settings/Admin/Sharing.php
@@ -88,7 +88,7 @@ class Sharing implements IDelegatedSettings {
'defaultExpireDate' => $this->getHumanBooleanConfig('core', 'shareapi_default_expire_date'),
'expireAfterNDays' => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'),
'enforceExpireDate' => $this->getHumanBooleanConfig('core', 'shareapi_enforce_expire_date'),
- 'excludeGroups' => $this->getHumanBooleanConfig('core', 'shareapi_exclude_groups'),
+ 'excludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no'),
'excludeGroupsList' => json_decode($excludedGroups, true) ?? [],
'publicShareDisclaimerText' => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null),
'enableLinkPasswordByDefault' => $this->getHumanBooleanConfig('core', 'shareapi_enable_link_password_by_default'),
diff --git a/apps/settings/src/components/AdminSettingsSharingForm.vue b/apps/settings/src/components/AdminSettingsSharingForm.vue
index 6850ab74243..122b3dfc642 100644
--- a/apps/settings/src/components/AdminSettingsSharingForm.vue
+++ b/apps/settings/src/components/AdminSettingsSharingForm.vue
@@ -76,19 +76,31 @@
</label>
</fieldset>
- <NcCheckboxRadioSwitch type="switch" :checked.sync="settings.excludeGroups">
- {{ t('settings', 'Exclude groups from sharing') }}
- </NcCheckboxRadioSwitch>
- <div v-show="settings.excludeGroups" class="sharing__sub-section">
- <div class="sharing__labeled-entry sharing__input">
- <label for="settings-sharing-excluded-groups">{{ t('settings', 'Groups excluded from sharing') }}</label>
+ <label>{{ t('settings', 'Limit sharing based on groups') }}</label>
+ <div class="sharing__sub-section">
+ <NcCheckboxRadioSwitch :checked.sync="settings.excludeGroups"
+ name="excludeGroups" value="no"
+ type="radio" @update:checked="onUpdateExcludeGroups">
+ {{ t('settings', 'Allow sharing for everyone (default)') }}
+ </NcCheckboxRadioSwitch>
+ <NcCheckboxRadioSwitch :checked.sync="settings.excludeGroups"
+ name="excludeGroups" value="yes"
+ type="radio" @update:checked="onUpdateExcludeGroups">
+ {{ t('settings', 'Exclude some groups from sharing') }}
+ </NcCheckboxRadioSwitch>
+ <NcCheckboxRadioSwitch :checked.sync="settings.excludeGroups"
+ name="excludeGroups" value="allow"
+ type="radio" @update:checked="onUpdateExcludeGroups">
+ {{ t('settings', 'Limit sharing to some groups') }}
+ </NcCheckboxRadioSwitch>
+ <div v-show="settings.excludeGroups !== 'no'" class="sharing__labeled-entry sharing__input">
<NcSettingsSelectGroup id="settings-sharing-excluded-groups"
v-model="settings.excludeGroupsList"
aria-describedby="settings-sharing-excluded-groups-desc"
- :label="t('settings', 'Groups excluded from sharing')"
- :disabled="!settings.excludeGroups"
+ :label="settings.excludeGroups === 'allow' ? t('settings', 'Groups allowed to share') : t('settings', 'Groups excluded from sharing')"
+ :disabled="settings.excludeGroups === 'no'"
style="width: 100%" />
- <em id="settings-sharing-excluded-groups-desc">{{ t('settings', 'These groups will still be able to receive shares, but not to initiate them.') }}</em>
+ <em id="settings-sharing-excluded-groups-desc">{{ t('settings', 'Not allowed groups will still be able to receive shares, but not to initiate them.') }}</em>
</div>
</div>
@@ -227,7 +239,7 @@ interface IShareSettings {
defaultExpireDate: boolean
expireAfterNDays: string
enforceExpireDate: boolean
- excludeGroups: boolean
+ excludeGroups: string
excludeGroupsList: string[]
publicShareDisclaimerText?: string
enableLinkPasswordByDefault: boolean
@@ -306,6 +318,10 @@ export default defineComponent({
}
this.settingsData.publicShareDisclaimerText = value
}, 500) as (v?: string) => void,
+ onUpdateExcludeGroups: debounce(function(value: string) {
+ window.OCP.AppConfig.setValue('core', 'excludeGroups', value)
+ this.settings.excludeGroups = value
+ }, 500) as (v?: string) => void
},
})
</script>
diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php
index 2abb2db3b6f..ae98ce6635b 100644
--- a/apps/settings/tests/Settings/Admin/SharingTest.php
+++ b/apps/settings/tests/Settings/Admin/SharingTest.php
@@ -150,7 +150,7 @@ class SharingTest extends TestCase {
'defaultExpireDate' => false,
'expireAfterNDays' => '7',
'enforceExpireDate' => false,
- 'excludeGroups' => false,
+ 'excludeGroups' => 'no',
'excludeGroupsList' => [],
'publicShareDisclaimerText' => 'Lorem ipsum',
'enableLinkPasswordByDefault' => true,
@@ -243,7 +243,7 @@ class SharingTest extends TestCase {
'defaultExpireDate' => false,
'expireAfterNDays' => '7',
'enforceExpireDate' => false,
- 'excludeGroups' => true,
+ 'excludeGroups' => 'yes',
'excludeGroupsList' => ['NoSharers','OtherNoSharers'],
'publicShareDisclaimerText' => 'Lorem ipsum',
'enableLinkPasswordByDefault' => true,