diff --git a/apps/systemtags/src/components/SystemTags.vue b/apps/systemtags/src/components/SystemTags.vue
index 1f2b38bf10aaa..f65a68dfd90e4 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
new file mode 100644
index 0000000000000..d0af07d4cd0d1
--- /dev/null
+++ b/apps/systemtags/src/components/SystemTagsCreationControl.vue
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
diff --git a/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts b/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts
index b0d68ef65ca13..c764db98f2952 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
}
diff --git a/apps/systemtags/src/services/api.ts b/apps/systemtags/src/services/api.ts
index ef44fa82daed8..7d53b566d39c4 100644
--- a/apps/systemtags/src/services/api.ts
+++ b/apps/systemtags/src/services/api.ts
@@ -7,13 +7,14 @@ import type { FileStat, ResponseDataDetailed, WebDAVClientError } from 'webdav'
import type { ServerTag, Tag, TagWithId } from '../types.js'
import axios from '@nextcloud/axios'
-import { generateUrl } from '@nextcloud/router'
+import { generateUrl, generateOcsUrl } from '@nextcloud/router'
import { t } from '@nextcloud/l10n'
import { davClient } from './davClient.js'
import { formatTag, parseIdFromLocation, parseTags } from '../utils'
import logger from '../logger.ts'
import { emit } from '@nextcloud/event-bus'
+import { confirmPassword } from '@nextcloud/password-confirmation'
export const fetchTagsPayload = `