diff options
-rw-r--r-- | apps/systemtags/src/components/SystemTags.vue | 6 | ||||
-rw-r--r-- | apps/systemtags/src/components/SystemTagsCreationControl.vue | 3 | ||||
-rw-r--r-- | apps/systemtags/src/files_actions/bulkSystemTagsAction.ts | 7 |
3 files changed, 15 insertions, 1 deletions
diff --git a/apps/systemtags/src/components/SystemTags.vue b/apps/systemtags/src/components/SystemTags.vue index 1f2b38bf10a..f65a68dfd90 100644 --- a/apps/systemtags/src/components/SystemTags.vue +++ b/apps/systemtags/src/components/SystemTags.vue @@ -51,6 +51,8 @@ import { setTagForFile, } from '../services/files.js' +import { loadState } from '@nextcloud/initial-state' + import type { Tag, TagWithId } from '../types.js' export default Vue.extend({ @@ -188,6 +190,10 @@ export default Vue.extend({ this.sortedTags.unshift(createdTag) this.selectedTags.push(createdTag) } catch (error) { + if(loadState('settings', 'restrictSystemTagsCreationToAdmin', '0') === '1') { + showError(t('systemtags', 'System admin disabled tag creation. You can only use existing ones.')) + return + } showError(t('systemtags', 'Failed to create tag')) } this.loading = false diff --git a/apps/systemtags/src/components/SystemTagsCreationControl.vue b/apps/systemtags/src/components/SystemTagsCreationControl.vue index 11d49288843..d0af07d4cd0 100644 --- a/apps/systemtags/src/components/SystemTagsCreationControl.vue +++ b/apps/systemtags/src/components/SystemTagsCreationControl.vue @@ -39,7 +39,8 @@ export default { data() { return { - systemTagsCreationRestrictedToAdmin: loadState('settings', 'restrictSystemTagsCreationToAdmin', '1') === '1', + // By default, system tags creation is not restricted to admins + systemTagsCreationRestrictedToAdmin: loadState('settings', 'restrictSystemTagsCreationToAdmin', '0') === '1', } }, methods: { diff --git a/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts b/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts index b0d68ef65ca..c764db98f29 100644 --- a/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts +++ b/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts @@ -9,6 +9,8 @@ import { FileAction } from '@nextcloud/files' import { isPublicShare } from '@nextcloud/sharing/public' import { spawnDialog } from '@nextcloud/dialogs' import { t } from '@nextcloud/l10n' +import { getCurrentUser } from '@nextcloud/auth' +import { loadState } from '@nextcloud/initial-state' import TagMultipleSvg from '@mdi/svg/svg/tag-multiple.svg?raw' @@ -34,6 +36,11 @@ export const action = new FileAction({ // If the app is disabled, the action is not available anyway enabled(nodes) { + // By default, everyone can create system tags + if (loadState('settings', 'restrictSystemTagsCreationToAdmin', '0') === '1' && getCurrentUser()?.isAdmin !== true) { + return false + } + if (isPublicShare()) { return false } |