mirror of
https://github.com/nextcloud/server.git
synced 2026-04-23 23:27:46 -04:00
feat(sharing): Toggle custom tokens setting as admin
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
0eb39d7b9c
commit
1a43fc5718
4 changed files with 36 additions and 2 deletions
|
|
@ -34,7 +34,8 @@ type FileSharingCapabilities = {
|
|||
},
|
||||
send_mail: boolean,
|
||||
upload: boolean,
|
||||
upload_files_drop: boolean
|
||||
upload_files_drop: boolean,
|
||||
custom_tokens: boolean,
|
||||
},
|
||||
resharing: boolean,
|
||||
user: {
|
||||
|
|
@ -298,4 +299,11 @@ export default class Config {
|
|||
return this._capabilities?.password_policy || {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if custom tokens are allowed
|
||||
*/
|
||||
get allowCustomTokens(): boolean {
|
||||
return this._capabilities?.files_sharing?.public?.custom_tokens
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
autocomplete="off"
|
||||
:label="t('files_sharing', 'Share label')"
|
||||
:value.sync="share.label" />
|
||||
<NcInputField v-if="isPublicShare && !isNewShare"
|
||||
<NcInputField v-if="config.allowCustomTokens && isPublicShare && !isNewShare"
|
||||
autocomplete="off"
|
||||
:label="t('files_sharing', 'Share link token')"
|
||||
:helper-text="t('files_sharing', 'Set the public share link token to something easy to remember or generate a new token. It is not recommended to use a guessable token for shares which contain sensitive information.')"
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ class Sharing implements IDelegatedSettings {
|
|||
'defaultRemoteExpireDate' => $this->getHumanBooleanConfig('core', 'shareapi_default_remote_expire_date'),
|
||||
'remoteExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'),
|
||||
'enforceRemoteExpireDate' => $this->getHumanBooleanConfig('core', 'shareapi_enforce_remote_expire_date'),
|
||||
'allowCustomTokens' => $this->shareManager->allowCustomTokens(),
|
||||
];
|
||||
|
||||
$this->initialState->provideInitialState('sharingAppEnabled', $this->appManager->isEnabledForUser('files_sharing'));
|
||||
|
|
|
|||
|
|
@ -59,6 +59,24 @@
|
|||
</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"
|
||||
|
|
@ -195,6 +213,7 @@
|
|||
import {
|
||||
NcCheckboxRadioSwitch,
|
||||
NcSettingsSelectGroup,
|
||||
NcNoteCard,
|
||||
NcTextArea,
|
||||
NcTextField,
|
||||
} from '@nextcloud/vue'
|
||||
|
|
@ -240,6 +259,7 @@ interface IShareSettings {
|
|||
defaultRemoteExpireDate: boolean
|
||||
remoteExpireAfterNDays: string
|
||||
enforceRemoteExpireDate: boolean
|
||||
allowCustomTokens: boolean
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
|
|
@ -247,6 +267,7 @@ export default defineComponent({
|
|||
components: {
|
||||
NcCheckboxRadioSwitch,
|
||||
NcSettingsSelectGroup,
|
||||
NcNoteCard,
|
||||
NcTextArea,
|
||||
NcTextField,
|
||||
SelectSharingPermissions,
|
||||
|
|
@ -354,6 +375,10 @@ export default defineComponent({
|
|||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
& &__note {
|
||||
margin: 2px 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 350px) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue