From 1a43fc57181f4ee7403a3a26d29a4e47dab96888 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Mon, 16 Dec 2024 15:53:12 -0800 Subject: [PATCH] feat(sharing): Toggle custom tokens setting as admin Signed-off-by: Christopher Ng --- .../src/services/ConfigService.ts | 10 +++++++- .../src/views/SharingDetailsTab.vue | 2 +- apps/settings/lib/Settings/Admin/Sharing.php | 1 + .../components/AdminSettingsSharingForm.vue | 25 +++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/src/services/ConfigService.ts b/apps/files_sharing/src/services/ConfigService.ts index 94db0454428..09fdca13598 100644 --- a/apps/files_sharing/src/services/ConfigService.ts +++ b/apps/files_sharing/src/services/ConfigService.ts @@ -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 + } + } diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index 4d46ec32796..f50a533eeeb 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -109,7 +109,7 @@ autocomplete="off" :label="t('files_sharing', 'Share label')" :value.sync="share.label" /> - $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')); diff --git a/apps/settings/src/components/AdminSettingsSharingForm.vue b/apps/settings/src/components/AdminSettingsSharingForm.vue index 2d3269563bb..23538b44e6e 100644 --- a/apps/settings/src/components/AdminSettingsSharingForm.vue +++ b/apps/settings/src/components/AdminSettingsSharingForm.vue @@ -59,6 +59,24 @@ + + {{ t('settings', 'Allow users to set custom share link tokens') }} + + +