aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/src/components/AdminSettingsSharingForm.vue
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/src/components/AdminSettingsSharingForm.vue')
-rw-r--r--apps/settings/src/components/AdminSettingsSharingForm.vue122
1 files changed, 83 insertions, 39 deletions
diff --git a/apps/settings/src/components/AdminSettingsSharingForm.vue b/apps/settings/src/components/AdminSettingsSharingForm.vue
index 38484c00d23..b0e142d8480 100644
--- a/apps/settings/src/components/AdminSettingsSharingForm.vue
+++ b/apps/settings/src/components/AdminSettingsSharingForm.vue
@@ -27,6 +27,15 @@
:label="t('settings', 'Ignore the following groups when checking group membership')"
style="width: 100%" />
</div>
+ <NcCheckboxRadioSwitch :checked.sync="settings.allowViewWithoutDownload">
+ {{ t('settings', 'Allow users to preview files even if download is disabled') }}
+ </NcCheckboxRadioSwitch>
+ <NcNoteCard v-show="settings.allowViewWithoutDownload"
+ id="settings-sharing-api-view-without-download-hint"
+ class="sharing__note"
+ type="warning">
+ {{ t('settings', 'Users will still be able to screenshot or record the screen. This does not provide any definitive protection.') }}
+ </NcNoteCard>
</div>
<div v-show="settings.enabled" id="settings-sharing-api" class="sharing__section">
@@ -39,15 +48,19 @@
<NcCheckboxRadioSwitch :checked.sync="settings.allowPublicUpload">
{{ t('settings', 'Allow public uploads') }}
</NcCheckboxRadioSwitch>
+ <NcCheckboxRadioSwitch v-model="settings.allowFederationOnPublicShares">
+ {{ t('settings', 'Allow public shares to be added to other clouds by federation.') }}
+ {{ t('settings', 'This will add share permissions to all newly created link shares.') }}
+ </NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch :checked.sync="settings.enableLinkPasswordByDefault">
{{ t('settings', 'Always ask for a password') }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch :checked.sync="settings.enforceLinksPassword" :disabled="!settings.enableLinkPasswordByDefault">
{{ t('settings', 'Enforce password protection') }}
</NcCheckboxRadioSwitch>
- <label v-if="settings.passwordExcludedGroupsFeatureEnabled" class="sharing__labeled-entry sharing__input">
+ <label v-if="settings.enforceLinksPasswordExcludedGroupsEnabled" class="sharing__labeled-entry sharing__input">
<span>{{ t('settings', 'Exclude groups from password requirements') }}</span>
- <NcSettingsSelectGroup v-model="settings.passwordExcludedGroups"
+ <NcSettingsSelectGroup v-model="settings.enforceLinksPasswordExcludedGroups"
style="width: 100%"
:disabled="!settings.enforceLinksPassword || !settings.enableLinkPasswordByDefault" />
</label>
@@ -59,21 +72,45 @@
</label>
</fieldset>
+ <NcCheckboxRadioSwitch type="switch"
+ aria-describedby="settings-sharing-custom-token-disable-hint settings-sharing-custom-token-access-hint"
+ :checked.sync="settings.allowCustomTokens">
+ {{ t('settings', 'Allow users to set custom share link tokens') }}
+ </NcCheckboxRadioSwitch>
+ <div class="sharing__sub-section">
+ <NcNoteCard id="settings-sharing-custom-token-disable-hint"
+ class="sharing__note"
+ type="info">
+ {{ t('settings', 'Shares with custom tokens will continue to be accessible after this setting has been disabled') }}
+ </NcNoteCard>
+ <NcNoteCard id="settings-sharing-custom-token-access-hint"
+ class="sharing__note"
+ type="warning">
+ {{ t('settings', 'Shares with guessable tokens may be accessed easily') }}
+ </NcNoteCard>
+ </div>
+
<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">
+ 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">
+ 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">
+ 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">
@@ -90,7 +127,7 @@
<NcCheckboxRadioSwitch type="switch"
aria-controls="settings-sharing-api-expiration"
:checked.sync="settings.defaultInternalExpireDate">
- {{ t('settings', 'Set default expiration date for shares') }}
+ {{ t('settings', 'Set default expiration date for internal shares') }}
</NcCheckboxRadioSwitch>
<fieldset v-show="settings.defaultInternalExpireDate" id="settings-sharing-api-expiration" class="sharing__sub-section">
<NcCheckboxRadioSwitch :checked.sync="settings.enforceInternalExpireDate">
@@ -127,7 +164,7 @@
</NcCheckboxRadioSwitch>
<fieldset v-show="settings.allowLinks && settings.defaultExpireDate" id="settings-sharing-api-api-expiration" class="sharing__sub-section">
<NcCheckboxRadioSwitch :checked.sync="settings.enforceExpireDate">
- {{ t('settings', 'Enforce expiration date for remote shares') }}
+ {{ t('settings', 'Enforce expiration date for link or mail shares') }}
</NcCheckboxRadioSwitch>
<NcTextField type="number"
class="sharing__input"
@@ -150,10 +187,10 @@
{{ t('settings', 'If autocompletion "same group" and "phone number integration" are enabled a match in either is enough to show the user.') }}
</em>
<NcCheckboxRadioSwitch :checked.sync="settings.restrictUserEnumerationToGroup">
- {{ t('settings', 'Allow account name autocompletion to users within the same groups and limit system address books to users in the same groups') }}
+ {{ t('settings', 'Restrict account name autocompletion and system address book access to users within the same groups') }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch :checked.sync="settings.restrictUserEnumerationToPhone">
- {{ t('settings', 'Allow account name autocompletion to users based on phone number integration') }}
+ {{ t('settings', 'Restrict account name autocompletion to users based on phone number integration') }}
</NcCheckboxRadioSwitch>
</fieldset>
@@ -164,7 +201,7 @@
<NcCheckboxRadioSwitch type="switch" :checked.sync="publicShareDisclaimerEnabled">
{{ t('settings', 'Show disclaimer text on the public link upload page (only shown when the file list is hidden)') }}
</NcCheckboxRadioSwitch>
- <div v-if="typeof settings.publicShareDisclaimerText === 'string'"
+ <div v-if="publicShareDisclaimerEnabled"
aria-describedby="settings-sharing-privary-related-disclaimer-hint"
class="sharing__sub-section">
<NcTextArea class="sharing__input"
@@ -186,19 +223,18 @@
</template>
<script lang="ts">
-import {
- NcCheckboxRadioSwitch,
- NcSettingsSelectGroup,
- NcTextArea,
- NcTextField,
-} from '@nextcloud/vue'
import { showError, showSuccess } from '@nextcloud/dialogs'
-import { translate as t } from '@nextcloud/l10n'
import { loadState } from '@nextcloud/initial-state'
+import { t } from '@nextcloud/l10n'
import { snakeCase } from 'lodash'
import { defineComponent } from 'vue'
import debounce from 'debounce'
+import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'
+import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
+import NcSettingsSelectGroup from '@nextcloud/vue/components/NcSettingsSelectGroup'
+import NcTextArea from '@nextcloud/vue/components/NcTextArea'
+import NcTextField from '@nextcloud/vue/components/NcTextField'
import SelectSharingPermissions from './SelectSharingPermissions.vue'
interface IShareSettings {
@@ -209,6 +245,7 @@ interface IShareSettings {
allowPublicUpload: boolean
allowResharing: boolean
allowShareDialogUserEnumeration: boolean
+ allowFederationOnPublicShares: boolean
restrictUserEnumerationToGroup: boolean
restrictUserEnumerationToPhone: boolean
restrictUserEnumerationFullMatch: boolean
@@ -216,8 +253,8 @@ interface IShareSettings {
restrictUserEnumerationFullMatchEmail: boolean
restrictUserEnumerationFullMatchIgnoreSecondDN: boolean
enforceLinksPassword: boolean
- passwordExcludedGroups: string[]
- passwordExcludedGroupsFeatureEnabled: boolean
+ enforceLinksPasswordExcludedGroups: string[]
+ enforceLinksPasswordExcludedGroupsEnabled: boolean
onlyShareWithGroupMembers: boolean
onlyShareWithGroupMembersExcludeGroupList: string[]
defaultExpireDate: boolean
@@ -225,7 +262,7 @@ interface IShareSettings {
enforceExpireDate: boolean
excludeGroups: string
excludeGroupsList: string[]
- publicShareDisclaimerText?: string
+ publicShareDisclaimerText: string
enableLinkPasswordByDefault: boolean
defaultPermissions: number
defaultInternalExpireDate: boolean
@@ -234,6 +271,8 @@ interface IShareSettings {
defaultRemoteExpireDate: boolean
remoteExpireAfterNDays: string
enforceRemoteExpireDate: boolean
+ allowCustomTokens: boolean
+ allowViewWithoutDownload: boolean
}
export default defineComponent({
@@ -241,13 +280,16 @@ export default defineComponent({
components: {
NcCheckboxRadioSwitch,
NcSettingsSelectGroup,
+ NcNoteCard,
NcTextArea,
NcTextField,
SelectSharingPermissions,
},
data() {
+ const settingsData = loadState<IShareSettings>('settings', 'sharingSettings')
return {
- settingsData: loadState<IShareSettings>('settings', 'sharingSettings'),
+ settingsData,
+ publicShareDisclaimerEnabled: settingsData.publicShareDisclaimerText !== '',
}
},
computed: {
@@ -266,26 +308,24 @@ export default defineComponent({
},
})
},
- publicShareDisclaimerEnabled: {
- get() {
- return typeof this.settingsData.publicShareDisclaimerText === 'string'
- },
- set(value) {
- if (value) {
- this.settingsData.publicShareDisclaimerText = ''
- } else {
- this.onUpdateDisclaimer()
- }
- },
+ },
+
+ watch: {
+ publicShareDisclaimerEnabled() {
+ // When disabled we just remove the disclaimer content
+ if (this.publicShareDisclaimerEnabled === false) {
+ this.onUpdateDisclaimer('')
+ }
},
},
+
methods: {
t,
- onUpdateDisclaimer: debounce(function(value?: string) {
+ onUpdateDisclaimer: debounce(function(value: string) {
const options = {
success() {
- if (value) {
+ if (value !== '') {
showSuccess(t('settings', 'Changed disclaimer text'))
} else {
showSuccess(t('settings', 'Deleted disclaimer text'))
@@ -295,7 +335,7 @@ export default defineComponent({
showError(t('settings', 'Could not set disclaimer text'))
},
}
- if (!value) {
+ if (value === '') {
window.OCP.AppConfig.deleteKey('core', 'shareapi_public_link_disclaimertext', options)
} else {
window.OCP.AppConfig.setValue('core', 'shareapi_public_link_disclaimertext', value, options)
@@ -305,7 +345,7 @@ export default defineComponent({
onUpdateExcludeGroups: debounce(function(value: string) {
window.OCP.AppConfig.setValue('core', 'excludeGroups', value)
this.settings.excludeGroups = value
- }, 500) as (v?: string) => void
+ }, 500) as (v?: string) => void,
},
})
</script>
@@ -348,6 +388,10 @@ export default defineComponent({
width: 100%;
}
}
+
+ & &__note {
+ margin: 2px 0;
+ }
}
@media only screen and (max-width: 350px) {