diff options
Diffstat (limited to 'apps/settings/src')
26 files changed, 214 insertions, 141 deletions
diff --git a/apps/settings/src/components/AdminAI.vue b/apps/settings/src/components/AdminAI.vue index afa08cd676e..044ebd9183e 100644 --- a/apps/settings/src/components/AdminAI.vue +++ b/apps/settings/src/components/AdminAI.vue @@ -6,6 +6,11 @@ <div class="ai-settings"> <NcSettingsSection :name="t('settings', 'Unified task processing')" :description="t('settings', 'AI tasks can be implemented by different apps. Here you can set which app should be used for which task.')"> + <NcCheckboxRadioSwitch v-model="settings['ai.taskprocessing_guests']" + type="switch" + @update:modelValue="saveChanges"> + {{ t('settings', 'Allow AI usage for guest users') }} + </NcCheckboxRadioSwitch> <template v-for="type in taskProcessingTaskTypes"> <div :key="type"> <h3>{{ t('settings', 'Task:') }} {{ type.name }}</h3> diff --git a/apps/settings/src/components/AdminSettingsSharingForm.vue b/apps/settings/src/components/AdminSettingsSharingForm.vue index 25dcbb7972d..c582e9febee 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,6 +48,10 @@ <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> @@ -232,6 +245,7 @@ interface IShareSettings { allowPublicUpload: boolean allowResharing: boolean allowShareDialogUserEnumeration: boolean + allowFederationOnPublicShares: boolean restrictUserEnumerationToGroup: boolean restrictUserEnumerationToPhone: boolean restrictUserEnumerationFullMatch: boolean @@ -258,6 +272,7 @@ interface IShareSettings { remoteExpireAfterNDays: string enforceRemoteExpireDate: boolean allowCustomTokens: boolean + allowViewWithoutDownload: boolean } export default defineComponent({ diff --git a/apps/settings/src/components/AppList/AppLevelBadge.vue b/apps/settings/src/components/AppList/AppLevelBadge.vue index 900aa69b74a..8461f5eb6b9 100644 --- a/apps/settings/src/components/AppList/AppLevelBadge.vue +++ b/apps/settings/src/components/AppList/AppLevelBadge.vue @@ -15,7 +15,7 @@ <script setup lang="ts"> import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper' -import { mdiCheck, mdiStarShooting } from '@mdi/js' +import { mdiCheck, mdiStarShootingOutline } from '@mdi/js' import { translate as t } from '@nextcloud/l10n' import { computed } from 'vue' @@ -28,7 +28,7 @@ const props = defineProps<{ const isSupported = computed(() => props.level === 300) const isFeatured = computed(() => props.level === 200) -const badgeIcon = computed(() => isSupported.value ? mdiStarShooting : mdiCheck) +const badgeIcon = computed(() => isSupported.value ? mdiStarShootingOutline : mdiCheck) const badgeText = computed(() => isSupported.value ? t('settings', 'Supported') : t('settings', 'Featured')) const badgeTitle = computed(() => isSupported.value ? t('settings', 'This app is supported via your current Nextcloud subscription.') diff --git a/apps/settings/src/components/AppNavigationGroupList.vue b/apps/settings/src/components/AppNavigationGroupList.vue index 5c648a17098..8f21d18d695 100644 --- a/apps/settings/src/components/AppNavigationGroupList.vue +++ b/apps/settings/src/components/AppNavigationGroupList.vue @@ -18,7 +18,7 @@ <template v-if="isAdminOrDelegatedAdmin" #actions> <NcActionText> <template #icon> - <NcIconSvgWrapper :path="mdiAccountGroup" /> + <NcIconSvgWrapper :path="mdiAccountGroupOutline" /> </template> {{ t('settings', 'Create group') }} </NcActionText> @@ -42,7 +42,7 @@ <NcAppNavigationList class="account-management__group-list" aria-describedby="group-list-desc" data-cy-users-settings-navigation-groups="custom"> - <GroupListItem v-for="group in userGroups" + <GroupListItem v-for="group in filteredGroups" :id="group.id" ref="groupListItems" :key="group.id" @@ -60,7 +60,7 @@ import type CancelablePromise from 'cancelable-promise' import type { IGroup } from '../views/user-types.d.ts' -import { mdiAccountGroup, mdiPlus } from '@mdi/js' +import { mdiAccountGroupOutline, mdiPlus } from '@mdi/js' import { showError } from '@nextcloud/dialogs' import { t } from '@nextcloud/l10n' import { useElementVisibility } from '@vueuse/core' @@ -96,7 +96,11 @@ const selectedGroup = computed(() => route.params?.selectedGroup) /** Current active group - URL decoded */ const selectedGroupDecoded = computed(() => selectedGroup.value ? decodeURIComponent(selectedGroup.value) : null) /** All available groups */ -const groups = computed(() => store.getters.getSortedGroups) +const groups = computed(() => { + return isAdminOrDelegatedAdmin.value + ? store.getters.getSortedGroups + : store.getters.getSubAdminGroups +}) /** User groups */ const { userGroups } = useFormatGroups(groups) /** Server settings for current user */ @@ -119,6 +123,14 @@ const loadingGroups = ref(false) const offset = ref(0) /** Search query for groups */ const groupsSearchQuery = ref('') +const filteredGroups = computed(() => { + if (isAdminOrDelegatedAdmin.value) { + return userGroups.value + } + + const substring = groupsSearchQuery.value.toLowerCase() + return userGroups.value.filter(group => group.id.toLowerCase().search(substring) !== -1 || group.title.toLowerCase().search(substring) !== -1) +}) const groupListItems = ref([]) const lastGroupListItem = computed(() => { diff --git a/apps/settings/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue b/apps/settings/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue index febc034514f..bb91940c763 100644 --- a/apps/settings/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue +++ b/apps/settings/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue @@ -8,7 +8,7 @@ :name="t('settings', 'Nothing to show')" :description="t('settings', 'Could not load section content from app store.')"> <template #icon> - <NcIconSvgWrapper :path="mdiEyeOff" :size="64" /> + <NcIconSvgWrapper :path="mdiEyeOffOutline" :size="64" /> </template> </NcEmptyContent> <NcEmptyContent v-else-if="elements.length === 0" @@ -30,7 +30,7 @@ <script setup lang="ts"> import type { IAppDiscoverElements } from '../../constants/AppDiscoverTypes.ts' -import { mdiEyeOff } from '@mdi/js' +import { mdiEyeOffOutline } from '@mdi/js' import { showError } from '@nextcloud/dialogs' import { translate as t } from '@nextcloud/l10n' import { generateUrl } from '@nextcloud/router' diff --git a/apps/settings/src/components/AppStoreSidebar/AppDeployOptionsModal.vue b/apps/settings/src/components/AppStoreSidebar/AppDeployOptionsModal.vue index 04c49827b02..67d4afa6566 100644 --- a/apps/settings/src/components/AppStoreSidebar/AppDeployOptionsModal.vue +++ b/apps/settings/src/components/AppStoreSidebar/AppDeployOptionsModal.vue @@ -65,7 +65,7 @@ style="margin-top: 6px;" @click="removeMount(mount)"> <template #icon> - <NcIconSvgWrapper :path="mdiDelete" /> + <NcIconSvgWrapper :path="mdiDeleteOutline" /> </template> </NcButton> </div> @@ -160,7 +160,7 @@ import NcButton from '@nextcloud/vue/components/NcButton' import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper' import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch' -import { mdiPlus, mdiCheck, mdiClose, mdiDelete } from '@mdi/js' +import { mdiPlus, mdiCheck, mdiClose, mdiDeleteOutline } from '@mdi/js' import { useAppApiStore } from '../../store/app-api-store.ts' import { useAppsStore } from '../../store/apps-store.ts' @@ -216,7 +216,7 @@ export default { mdiPlus, mdiCheck, mdiClose, - mdiDelete, + mdiDeleteOutline, } }, data() { diff --git a/apps/settings/src/components/AppStoreSidebar/AppDetailsTab.vue b/apps/settings/src/components/AppStoreSidebar/AppDetailsTab.vue index 3aa42f1d15a..8a387b55ecf 100644 --- a/apps/settings/src/components/AppStoreSidebar/AppDetailsTab.vue +++ b/apps/settings/src/components/AppStoreSidebar/AppDetailsTab.vue @@ -8,7 +8,7 @@ :name="t('settings', 'Details')" :order="1"> <template #icon> - <NcIconSvgWrapper :path="mdiTextBox" /> + <NcIconSvgWrapper :path="mdiTextBoxOutline" /> </template> <div class="app-details"> <div class="app-details__actions"> @@ -82,7 +82,7 @@ type="secondary" @click="() => showDeployOptionsModal = true"> <template #icon> - <NcIconSvgWrapper :path="mdiToyBrickPlus" /> + <NcIconSvgWrapper :path="mdiToyBrickPlusOutline" /> </template> {{ t('settings', 'Deploy options') }} </NcButton> @@ -162,7 +162,7 @@ :aria-label="t('settings', 'Report a bug')" :title="t('settings', 'Report a bug')"> <template #icon> - <NcIconSvgWrapper :path="mdiBug" /> + <NcIconSvgWrapper :path="mdiBugOutline" /> </template> </NcButton> <NcButton :disabled="!app.bugs" @@ -170,7 +170,7 @@ :aria-label="t('settings', 'Request feature')" :title="t('settings', 'Request feature')"> <template #icon> - <NcIconSvgWrapper :path="mdiFeatureSearch" /> + <NcIconSvgWrapper :path="mdiFeatureSearchOutline" /> </template> </NcButton> <NcButton v-if="app.appstoreData?.discussion" @@ -178,7 +178,7 @@ :aria-label="t('settings', 'Ask questions or discuss')" :title="t('settings', 'Ask questions or discuss')"> <template #icon> - <NcIconSvgWrapper :path="mdiTooltipQuestion" /> + <NcIconSvgWrapper :path="mdiTooltipQuestionOutline" /> </template> </NcButton> <NcButton v-if="!app.internal" @@ -209,7 +209,7 @@ import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwit import AppDeployOptionsModal from './AppDeployOptionsModal.vue' import AppManagement from '../../mixins/AppManagement.js' -import { mdiBug, mdiFeatureSearch, mdiStar, mdiTextBox, mdiTooltipQuestion, mdiToyBrickPlus } from '@mdi/js' +import { mdiBugOutline, mdiFeatureSearchOutline, mdiStar, mdiTextBoxOutline, mdiTooltipQuestionOutline, mdiToyBrickPlusOutline } from '@mdi/js' import { useAppsStore } from '../../store/apps-store' import { useAppApiStore } from '../../store/app-api-store' @@ -242,12 +242,12 @@ export default { store, appApiStore, - mdiBug, - mdiFeatureSearch, + mdiBugOutline, + mdiFeatureSearchOutline, mdiStar, - mdiTextBox, - mdiTooltipQuestion, - mdiToyBrickPlus, + mdiTextBoxOutline, + mdiTooltipQuestionOutline, + mdiToyBrickPlusOutline, } }, diff --git a/apps/settings/src/components/AuthToken.vue b/apps/settings/src/components/AuthToken.vue index 6f3e931d1b9..15286adb135 100644 --- a/apps/settings/src/components/AuthToken.vue +++ b/apps/settings/src/components/AuthToken.vue @@ -80,7 +80,7 @@ import type { PropType } from 'vue' import type { IToken } from '../store/authtoken' -import { mdiCheck, mdiCellphone, mdiTablet, mdiMonitor, mdiWeb, mdiKey, mdiMicrosoftEdge, mdiFirefox, mdiGoogleChrome, mdiAppleSafari, mdiAndroid, mdiAppleIos } from '@mdi/js' +import { mdiCheck, mdiCellphone, mdiTablet, mdiMonitor, mdiWeb, mdiKeyOutline, mdiMicrosoftEdge, mdiFirefox, mdiGoogleChrome, mdiAppleSafari, mdiAndroid, mdiAppleIos } from '@mdi/js' import { translate as t } from '@nextcloud/l10n' import { defineComponent } from 'vue' import { TokenType, useAuthTokenStore } from '../store/authtoken.ts' @@ -215,7 +215,7 @@ export default defineComponent({ tokenIcon() { // For custom created app tokens / app passwords if (this.token.type === TokenType.PERMANENT_TOKEN) { - return mdiKey + return mdiKeyOutline } switch (this.client?.id) { diff --git a/apps/settings/src/components/DeclarativeSettings/DeclarativeSection.vue b/apps/settings/src/components/DeclarativeSettings/DeclarativeSection.vue index 334739337e1..9ee1680516e 100644 --- a/apps/settings/src/components/DeclarativeSettings/DeclarativeSection.vue +++ b/apps/settings/src/components/DeclarativeSettings/DeclarativeSection.vue @@ -119,6 +119,7 @@ import NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection' import NcInputField from '@nextcloud/vue/components/NcInputField' import NcSelect from '@nextcloud/vue/components/NcSelect' import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch' +import { confirmPassword } from '@nextcloud/password-confirmation' export default { name: 'DeclarativeSection', @@ -202,9 +203,19 @@ export default { } }, - updateDeclarativeSettingsValue(formField, value = null) { + async updateDeclarativeSettingsValue(formField, value = null) { try { - return axios.post(generateOcsUrl('settings/api/declarative/value'), { + let url = generateOcsUrl('settings/api/declarative/value') + if (formField?.sensitive === true) { + url = generateOcsUrl('settings/api/declarative/value-sensitive') + try { + await confirmPassword() + } catch (err) { + showError(t('settings', 'Password confirmation is required')) + return + } + } + return axios.post(url, { app: this.formApp, formId: this.form.id.replace(this.formApp + '_', ''), // Remove app prefix to send clean form id fieldId: formField.id, diff --git a/apps/settings/src/components/GroupListItem.vue b/apps/settings/src/components/GroupListItem.vue index 65d46136ec1..69bb8a3f575 100644 --- a/apps/settings/src/components/GroupListItem.vue +++ b/apps/settings/src/components/GroupListItem.vue @@ -13,7 +13,7 @@ </h2> <NcNoteCard type="warning" show-alert> - {{ t('settings', 'You are about to remove the group "{group}". The accounts will NOT be deleted.', { group: name }) }} + {{ t('settings', 'You are about to delete the group "{group}". The accounts will NOT be deleted.', { group: name }) }} </NcNoteCard> <div class="modal__button-row"> <NcButton type="secondary" @@ -62,7 +62,7 @@ <template #icon> <Delete :size="20" /> </template> - {{ t('settings', 'Remove group') }} + {{ t('settings', 'Delete group') }} </NcActionButton> </template> </NcAppNavigationItem> @@ -80,9 +80,9 @@ import NcCounterBubble from '@nextcloud/vue/components/NcCounterBubble' import NcModal from '@nextcloud/vue/components/NcModal' import NcNoteCard from '@nextcloud/vue/components/NcNoteCard' -import AccountGroup from 'vue-material-design-icons/AccountGroup.vue' -import Delete from 'vue-material-design-icons/Delete.vue' -import Pencil from 'vue-material-design-icons/Pencil.vue' +import AccountGroup from 'vue-material-design-icons/AccountGroupOutline.vue' +import Delete from 'vue-material-design-icons/DeleteOutline.vue' +import Pencil from 'vue-material-design-icons/PencilOutline.vue' import { showError } from '@nextcloud/dialogs' @@ -179,7 +179,7 @@ export default { await this.$store.dispatch('removeGroup', this.id) this.showRemoveGroupModal = false } catch (error) { - showError(t('settings', 'Failed to remove group "{group}"', { group: this.name })) + showError(t('settings', 'Failed to delete group "{group}"', { group: this.name })) } }, }, diff --git a/apps/settings/src/components/PersonalInfo/AvatarSection.vue b/apps/settings/src/components/PersonalInfo/AvatarSection.vue index 400ccb510f3..a99f228668c 100644 --- a/apps/settings/src/components/PersonalInfo/AvatarSection.vue +++ b/apps/settings/src/components/PersonalInfo/AvatarSection.vue @@ -88,7 +88,7 @@ import 'cropperjs/dist/cropper.css' import Upload from 'vue-material-design-icons/Upload.vue' import Folder from 'vue-material-design-icons/Folder.vue' -import Delete from 'vue-material-design-icons/Delete.vue' +import Delete from 'vue-material-design-icons/DeleteOutline.vue' import HeaderBar from './shared/HeaderBar.vue' import { NAME_READABLE_ENUM } from '../../constants/AccountPropertyConstants.js' diff --git a/apps/settings/src/components/PersonalInfo/DetailsSection.vue b/apps/settings/src/components/PersonalInfo/DetailsSection.vue index b0eb137d9e5..d4bb0ce16ec 100644 --- a/apps/settings/src/components/PersonalInfo/DetailsSection.vue +++ b/apps/settings/src/components/PersonalInfo/DetailsSection.vue @@ -36,7 +36,7 @@ import { loadState } from '@nextcloud/initial-state' import { t } from '@nextcloud/l10n' import NcProgressBar from '@nextcloud/vue/components/NcProgressBar' -import Account from 'vue-material-design-icons/Account.vue' +import Account from 'vue-material-design-icons/AccountOutline.vue' import CircleSlice from 'vue-material-design-icons/CircleSlice3.vue' import HeaderBar from './shared/HeaderBar.vue' diff --git a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue index de6114b57bc..6a6baef8817 100644 --- a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue +++ b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue @@ -48,7 +48,7 @@ :disabled="deleteDisabled" @click="deleteEmail"> <template #icon> - <NcIconSvgWrapper :path="mdiTrashCan" /> + <NcIconSvgWrapper :path="mdiTrashCanOutline" /> </template> {{ deleteEmailLabel }} </NcActionButton> @@ -71,7 +71,7 @@ import NcTextField from '@nextcloud/vue/components/NcTextField' import debounce from 'debounce' -import { mdiArrowLeft, mdiLock, mdiStar, mdiStarOutline, mdiTrashCan } from '@mdi/js' +import { mdiArrowLeft, mdiLockOutline, mdiStar, mdiStarOutline, mdiTrashCanOutline } from '@mdi/js' import FederationControl from '../shared/FederationControl.vue' import { handleError } from '../../../utils/handlers.ts' @@ -133,10 +133,10 @@ export default { setup() { return { mdiArrowLeft, - mdiLock, + mdiLockOutline, mdiStar, mdiStarOutline, - mdiTrashCan, + mdiTrashCanOutline, saveAdditionalEmailScope, } }, diff --git a/apps/settings/src/components/PersonalInfo/PronounsSection.vue b/apps/settings/src/components/PersonalInfo/PronounsSection.vue index fb35b1800c5..e345cb8e225 100644 --- a/apps/settings/src/components/PersonalInfo/PronounsSection.vue +++ b/apps/settings/src/components/PersonalInfo/PronounsSection.vue @@ -8,16 +8,18 @@ :placeholder="randomPronounsPlaceholder" /> </template> -<script> -import { loadState } from '@nextcloud/initial-state' +<script lang="ts"> +import type { IAccountProperty } from '../../constants/AccountPropertyConstants.ts' +import { loadState } from '@nextcloud/initial-state' +import { t } from '@nextcloud/l10n' +import { defineComponent } from 'vue' import AccountPropertySection from './shared/AccountPropertySection.vue' +import { NAME_READABLE_ENUM } from '../../constants/AccountPropertyConstants.ts' -import { NAME_READABLE_ENUM } from '../../constants/AccountPropertyConstants.js' - -const { pronouns } = loadState('settings', 'personalInfoParameters', {}) +const { pronouns } = loadState<{ pronouns: IAccountProperty }>('settings', 'personalInfoParameters') -export default { +export default defineComponent({ name: 'PronounsSection', components: { @@ -33,13 +35,13 @@ export default { computed: { randomPronounsPlaceholder() { const pronouns = [ - this.t('settings', 'she/her'), - this.t('settings', 'he/him'), - this.t('settings', 'they/them'), + t('settings', 'she/her'), + t('settings', 'he/him'), + t('settings', 'they/them'), ] const pronounsExample = pronouns[Math.floor(Math.random() * pronouns.length)] - return this.t('settings', `Your pronouns. E.g. ${pronounsExample}`, { pronounsExample }) + return t('settings', 'Your pronouns. E.g. {pronounsExample}', { pronounsExample }) }, }, -} +}) </script> diff --git a/apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue b/apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue index 8cdde6b7d9a..d039641ec72 100644 --- a/apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue +++ b/apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue @@ -155,6 +155,7 @@ export default { methods: { async updateProperty(value) { try { + this.hasError = false const responseData = await savePrimaryAccountProperty( this.name, value, @@ -180,10 +181,8 @@ export default { this.isSuccess = true setTimeout(() => { this.isSuccess = false }, 2000) } else { - this.$emit('update:value', this.initialValue) handleError(error, errorMessage) this.hasError = true - setTimeout(() => { this.hasError = false }, 2000) } }, }, diff --git a/apps/settings/src/components/UserList.vue b/apps/settings/src/components/UserList.vue index 84c204805cc..459548fad26 100644 --- a/apps/settings/src/components/UserList.vue +++ b/apps/settings/src/components/UserList.vue @@ -19,7 +19,7 @@ <NcLoadingIcon v-if="isInitialLoad && loading.users" :name="t('settings', 'Loading accounts …')" :size="64" /> - <NcIconSvgWrapper v-else :path="mdiAccountGroup" :size="64" /> + <NcIconSvgWrapper v-else :path="mdiAccountGroupOutline" :size="64" /> </template> </NcEmptyContent> @@ -58,7 +58,7 @@ </template> <script> -import { mdiAccountGroup } from '@mdi/js' +import { mdiAccountGroupOutline } from '@mdi/js' import { showError } from '@nextcloud/dialogs' import { subscribe, unsubscribe } from '@nextcloud/event-bus' import { Fragment } from 'vue-frag' @@ -120,7 +120,7 @@ export default { setup() { // non reactive properties return { - mdiAccountGroup, + mdiAccountGroupOutline, rowHeight: 55, UserRow, diff --git a/apps/settings/src/components/Users/NewUserDialog.vue b/apps/settings/src/components/Users/NewUserDialog.vue index 19445bc187e..ef401b565fa 100644 --- a/apps/settings/src/components/Users/NewUserDialog.vue +++ b/apps/settings/src/components/Users/NewUserDialog.vue @@ -86,7 +86,7 @@ :input-label="t('settings', 'Admin of the following groups')" :placeholder="t('settings', 'Set account as admin for …')" :disabled="loading.groups || loading.all" - :options="subAdminsGroups" + :options="availableGroups" :close-on-select="false" :multiple="true" label="name" @@ -179,7 +179,6 @@ export default { data() { return { - availableGroups: [], possibleManagers: [], // TRANSLATORS This string describes a manager in the context of an organization managerInputLabel: t('settings', 'Manager'), @@ -210,9 +209,12 @@ export default { return this.$store.getters.getPasswordPolicyMinLength }, - subAdminsGroups() { - // data provided php side - return this.availableGroups.filter(group => group.id !== 'admin' && group.id !== '__nc_internal_recent' && group.id !== 'disabled') + availableGroups() { + const groups = (this.settings.isAdmin || this.settings.isDelegatedAdmin) + ? this.$store.getters.getSortedGroups + : this.$store.getters.getSubAdminGroups + + return groups.filter(group => group.id !== '__nc_internal_recent' && group.id !== 'disabled') }, languages() { @@ -236,13 +238,6 @@ export default { }, mounted() { - // admins also can assign the system groups - if (this.isAdmin || this.isDelegatedAdmin) { - this.availableGroups = this.$store.getters.getSortedGroups.filter(group => group.id !== '__nc_internal_recent' && group.id !== 'disabled') - } else { - this.availableGroups = [...this.$store.getters.getSubAdminGroups] - } - this.$refs.username?.focus?.() }, @@ -281,7 +276,7 @@ export default { }, async searchGroups(query, toggleLoading) { - if (!this.isAdmin && !this.isDelegatedAdmin) { + if (!this.settings.isAdmin && !this.settings.isDelegatedAdmin) { // managers cannot search for groups return } @@ -297,7 +292,10 @@ export default { limit: 25, }) const groups = await this.promise - this.availableGroups = groups + // Populate store from server request + for (const group of groups) { + this.$store.commit('addGroup', group) + } } catch (error) { logger.error(t('settings', 'Failed to search groups'), { error }) } @@ -315,7 +313,6 @@ export default { this.loading.groups = true try { await this.$store.dispatch('addGroup', gid) - this.availableGroups.push({ id: gid, name: gid }) this.newUser.groups.push({ id: gid, name: gid }) } catch (error) { logger.error(t('settings', 'Failed to create group'), { error }) @@ -349,7 +346,7 @@ export default { const validQuota = OC.Util.computerFileSize(quota) if (validQuota !== null && validQuota >= 0) { // unify format output - quota = formatFileSize(parseFileSize(quota)) + quota = formatFileSize(parseFileSize(quota, true)) this.newUser.quota = { id: quota, label: quota } return this.newUser.quota } diff --git a/apps/settings/src/components/Users/UserRow.vue b/apps/settings/src/components/Users/UserRow.vue index 987cf84492a..43668725972 100644 --- a/apps/settings/src/components/Users/UserRow.vue +++ b/apps/settings/src/components/Users/UserRow.vue @@ -255,16 +255,17 @@ data-cy-user-list-input-manager :data-loading="loading.manager || undefined" :input-id="'manager' + uniqueId" - :close-on-select="true" :disabled="isLoadingField" - :append-to-body="false" :loading="loadingPossibleManagers || loading.manager" - label="displayname" :options="possibleManagers" :placeholder="managerLabel" + label="displayname" + :filterable="false" + :internal-search="false" + :clearable="true" @open="searchInitialUserManager" @search="searchUserManager" - @option:selected="updateUserManager" /> + @update:model-value="updateUserManager" /> </template> <span v-else-if="!isObfuscated"> {{ user.manager }} @@ -410,15 +411,35 @@ export default { return encodeURIComponent(this.user.id + this.rand) }, + availableGroups() { + const groups = (this.settings.isAdmin || this.settings.isDelegatedAdmin) + ? this.$store.getters.getSortedGroups + : this.$store.getters.getSubAdminGroups + + return groups.filter(group => group.id !== '__nc_internal_recent' && group.id !== 'disabled') + }, + + availableSubAdminGroups() { + return this.availableGroups.filter(group => group.id !== 'admin') + }, + userGroupsLabels() { return this.userGroups - .map(group => group.name ?? group.id) + .map(group => { + // Try to match with more extensive group data + const availableGroup = this.availableGroups.find(g => g.id === group.id) + return availableGroup?.name ?? group.name ?? group.id + }) .join(', ') }, userSubAdminGroupsLabels() { return this.userSubAdminGroups - .map(group => group.name ?? group.id) + .map(group => { + // Try to match with more extensive group data + const availableGroup = this.availableSubAdminGroups.find(g => g.id === group.id) + return availableGroup?.name ?? group.name ?? group.id + }) .join(', ') }, @@ -502,7 +523,6 @@ export default { return this.languages[0].languages.concat(this.languages[1].languages) }, }, - async beforeMount() { if (this.user.manager) { await this.initManager(this.user.manager) @@ -559,7 +579,11 @@ export default { this.loading.groupsDetails = true try { const groups = await loadUserGroups({ userId: this.user.id }) - this.availableGroups = this.availableGroups.map(availableGroup => groups.find(group => group.id === availableGroup.id) ?? availableGroup) + // Populate store from server request + for (const group of groups) { + this.$store.commit('addGroup', group) + } + this.selectedGroups = this.selectedGroups.map(selectedGroup => groups.find(group => group.id === selectedGroup.id) ?? selectedGroup) } catch (error) { logger.error(t('settings', 'Failed to load groups with details'), { error }) } @@ -572,7 +596,11 @@ export default { this.loading.subAdminGroupsDetails = true try { const groups = await loadUserSubAdminGroups({ userId: this.user.id }) - this.availableSubAdminGroups = this.availableSubAdminGroups.map(availableGroup => groups.find(group => group.id === availableGroup.id) ?? availableGroup) + // Populate store from server request + for (const group of groups) { + this.$store.commit('addGroup', group) + } + this.selectedSubAdminGroups = this.selectedSubAdminGroups.map(selectedGroup => groups.find(group => group.id === selectedGroup.id) ?? selectedGroup) } catch (error) { logger.error(t('settings', 'Failed to load sub admin groups with details'), { error }) } @@ -595,8 +623,10 @@ export default { limit: 25, }) const groups = await this.promise - this.availableGroups = groups - this.availableSubAdminGroups = groups.filter(group => group.id !== 'admin') + // Populate store from server request + for (const group of groups) { + this.$store.commit('addGroup', group) + } } catch (error) { logger.error(t('settings', 'Failed to search groups'), { error }) } @@ -613,11 +643,12 @@ export default { }) }, - async updateUserManager(manager) { - if (manager === null) { - this.currentManager = '' - } + async updateUserManager() { this.loading.manager = true + + // Store the current manager before making changes + const previousManager = this.user.manager + try { await this.$store.dispatch('setUserData', { userid: this.user.id, @@ -627,7 +658,10 @@ export default { } catch (error) { // TRANSLATORS This string describes a line manager in the context of an organization showError(t('settings', 'Failed to update line manager')) - console.error(error) + logger.error('Failed to update manager:', { error }) + + // Revert to the previous manager in the UI on error + this.currentManager = previousManager } finally { this.loading.manager = false } @@ -753,8 +787,6 @@ export default { this.loading.groups = true try { await this.$store.dispatch('addGroup', gid) - this.availableGroups.push({ id: gid, name: gid }) - this.availableSubAdminGroups.push({ id: gid, name: gid }) const userid = this.user.id await this.$store.dispatch('addUserGroup', { userid, gid }) this.userGroups.push({ id: gid, name: gid }) diff --git a/apps/settings/src/components/Users/UserRowActions.vue b/apps/settings/src/components/Users/UserRowActions.vue index 8e30d584dfd..efd70d879a7 100644 --- a/apps/settings/src/components/Users/UserRowActions.vue +++ b/apps/settings/src/components/Users/UserRowActions.vue @@ -39,7 +39,7 @@ import NcActionButton from '@nextcloud/vue/components/NcActionButton' import NcActions from '@nextcloud/vue/components/NcActions' import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper' import SvgCheck from '@mdi/svg/svg/check.svg?raw' -import SvgPencil from '@mdi/svg/svg/pencil.svg?raw' +import SvgPencil from '@mdi/svg/svg/pencil-outline.svg?raw' interface UserAction { action: (event: MouseEvent, user: Record<string, unknown>) => void, diff --git a/apps/settings/src/composables/useGroupsNavigation.ts b/apps/settings/src/composables/useGroupsNavigation.ts index 6235088f944..d9f0637843b 100644 --- a/apps/settings/src/composables/useGroupsNavigation.ts +++ b/apps/settings/src/composables/useGroupsNavigation.ts @@ -17,14 +17,12 @@ function formatGroupMenu(group?: IGroup) { return null } - const item = { + return { id: group.id, title: group.name, - usercount: group.usercount, - count: Math.max(0, group.usercount - group.disabled), + usercount: group.usercount ?? 0, + count: Math.max(0, (group.usercount ?? 0) - (group.disabled ?? 0)), } - - return item } export const useFormatGroups = (groups: Ref<IGroup[]>|ComputedRef<IGroup[]>) => { diff --git a/apps/settings/src/constants/AccountPropertyConstants.ts b/apps/settings/src/constants/AccountPropertyConstants.ts index 5ea15e05c6c..455c210976f 100644 --- a/apps/settings/src/constants/AccountPropertyConstants.ts +++ b/apps/settings/src/constants/AccountPropertyConstants.ts @@ -7,7 +7,7 @@ * SYNC to be kept in sync with `lib/public/Accounts/IAccountManager.php` */ -import { mdiAccountGroup, mdiCellphone, mdiLock, mdiWeb } from '@mdi/js' +import { mdiAccountGroupOutline, mdiCellphone, mdiLockOutline, mdiWeb } from '@mdi/js' import { translate as t } from '@nextcloud/l10n' /** Enum of account properties */ @@ -171,14 +171,14 @@ export const SCOPE_PROPERTY_ENUM = Object.freeze({ displayName: t('settings', 'Local'), tooltip: t('settings', 'Only visible to people on this instance and guests'), // tooltipDisabled is not required here as this scope is supported by all account properties - icon: mdiLock, + icon: mdiLockOutline, }, [SCOPE_ENUM.FEDERATED]: { name: SCOPE_ENUM.FEDERATED, displayName: t('settings', 'Federated'), tooltip: t('settings', 'Only synchronize to trusted servers'), tooltipDisabled: t('settings', 'Not available as federation has been disabled for your account, contact your system administration if you have any questions'), - icon: mdiAccountGroup, + icon: mdiAccountGroupOutline, }, [SCOPE_ENUM.PUBLISHED]: { name: SCOPE_ENUM.PUBLISHED, diff --git a/apps/settings/src/constants/AppstoreCategoryIcons.ts b/apps/settings/src/constants/AppstoreCategoryIcons.ts index 7e7e00df9b0..24bb0faea6d 100644 --- a/apps/settings/src/constants/AppstoreCategoryIcons.ts +++ b/apps/settings/src/constants/AppstoreCategoryIcons.ts @@ -3,29 +3,29 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ import { - mdiAccount, - mdiAccountMultiple, - mdiArchive, + mdiAccountOutline, + mdiAccountMultipleOutline, + mdiArchiveOutline, mdiCheck, - mdiClipboardFlow, + mdiClipboardFlowOutline, mdiClose, - mdiCog, - mdiControllerClassic, + mdiCogOutline, + mdiControllerClassicOutline, mdiDownload, mdiFileDocumentEdit, mdiFolder, - mdiKey, + mdiKeyOutline, mdiMagnify, mdiMonitorEye, mdiMultimedia, - mdiOfficeBuilding, + mdiOfficeBuildingOutline, mdiOpenInApp, mdiSecurity, mdiStar, mdiStarCircleOutline, - mdiStarShooting, + mdiStarShootingOutline, mdiTools, - mdiViewColumn, + mdiViewColumnOutline, } from '@mdi/js' /** @@ -34,28 +34,28 @@ import { export default Object.freeze({ // system special categories discover: mdiStarCircleOutline, - installed: mdiAccount, + installed: mdiAccountOutline, enabled: mdiCheck, disabled: mdiClose, - bundles: mdiArchive, - supported: mdiStarShooting, + bundles: mdiArchiveOutline, + supported: mdiStarShootingOutline, featured: mdiStar, updates: mdiDownload, // generic categories - auth: mdiKey, - customization: mdiCog, - dashboard: mdiViewColumn, + auth: mdiKeyOutline, + customization: mdiCogOutline, + dashboard: mdiViewColumnOutline, files: mdiFolder, - games: mdiControllerClassic, + games: mdiControllerClassicOutline, integration: mdiOpenInApp, monitoring: mdiMonitorEye, multimedia: mdiMultimedia, office: mdiFileDocumentEdit, - organization: mdiOfficeBuilding, + organization: mdiOfficeBuildingOutline, search: mdiMagnify, security: mdiSecurity, - social: mdiAccountMultiple, + social: mdiAccountMultipleOutline, tools: mdiTools, - workflow: mdiClipboardFlow, + workflow: mdiClipboardFlowOutline, }) diff --git a/apps/settings/src/main-declarative-settings-forms.ts b/apps/settings/src/main-declarative-settings-forms.ts index 6e2d71b69ca..d6f5973baea 100644 --- a/apps/settings/src/main-declarative-settings-forms.ts +++ b/apps/settings/src/main-declarative-settings-forms.ts @@ -20,6 +20,7 @@ interface DeclarativeFormField { options: Array<unknown>|null, value: unknown, default: unknown, + sensitive: boolean, } interface DeclarativeForm { diff --git a/apps/settings/src/mixins/UserRowMixin.js b/apps/settings/src/mixins/UserRowMixin.js index 2cb69ff2e96..9e46d8e25d7 100644 --- a/apps/settings/src/mixins/UserRowMixin.js +++ b/apps/settings/src/mixins/UserRowMixin.js @@ -43,8 +43,8 @@ export default { }, data() { return { - availableGroups: this.user.groups.map(id => ({ id, name: id })), - availableSubAdminGroups: this.user.subadmin.map(id => ({ id, name: id })), + selectedGroups: this.user.groups.map(id => ({ id, name: id })), + selectedSubAdminGroups: this.user.subadmin.map(id => ({ id, name: id })), userGroups: this.user.groups.map(id => ({ id, name: id })), userSubAdminGroups: this.user.subadmin.map(id => ({ id, name: id })), } diff --git a/apps/settings/src/store/users.js b/apps/settings/src/store/users.js index 3734b7008df..7e4b9c4aebb 100644 --- a/apps/settings/src/store/users.js +++ b/apps/settings/src/store/users.js @@ -767,24 +767,25 @@ const actions = { */ async setUserData(context, { userid, key, value }) { const allowedEmpty = ['email', 'displayname', 'manager'] - if (['email', 'language', 'quota', 'displayname', 'password', 'manager'].indexOf(key) !== -1) { - // We allow empty email or displayname - if (typeof value === 'string' - && ( - (allowedEmpty.indexOf(key) === -1 && value.length > 0) - || allowedEmpty.indexOf(key) !== -1 - ) - ) { - try { - await api.requireAdmin() - await api.put(generateOcsUrl('cloud/users/{userid}', { userid }), { key, value }) - return context.commit('setUserData', { userid, key, value }) - } catch (error) { - context.commit('API_FAILURE', { userid, error }) - } - } + const validKeys = ['email', 'language', 'quota', 'displayname', 'password', 'manager'] + + if (!validKeys.includes(key)) { + throw new Error('Invalid request data') + } + + // If value is empty and the key doesn't allow empty values, throw error + if (value === '' && !allowedEmpty.includes(key)) { + throw new Error('Value cannot be empty for this field') + } + + try { + await api.requireAdmin() + await api.put(generateOcsUrl('cloud/users/{userid}', { userid }), { key, value }) + return context.commit('setUserData', { userid, key, value }) + } catch (error) { + context.commit('API_FAILURE', { userid, error }) + throw error } - return Promise.reject(new Error('Invalid request data')) }, /** diff --git a/apps/settings/src/views/UserManagementNavigation.vue b/apps/settings/src/views/UserManagementNavigation.vue index df3670bcfc7..95a12ac7c51 100644 --- a/apps/settings/src/views/UserManagementNavigation.vue +++ b/apps/settings/src/views/UserManagementNavigation.vue @@ -22,7 +22,7 @@ :name="t('settings', 'All accounts')" :to="{ name: 'users' }"> <template #icon> - <NcIconSvgWrapper :path="mdiAccount" /> + <NcIconSvgWrapper :path="mdiAccountOutline" /> </template> <template #counter> <NcCounterBubble v-if="userCount" :type="!selectedGroupDecoded ? 'highlighted' : undefined"> @@ -37,7 +37,7 @@ :name="t('settings', 'Admins')" :to="{ name: 'group', params: { selectedGroup: 'admin' } }"> <template #icon> - <NcIconSvgWrapper :path="mdiShieldAccount" /> + <NcIconSvgWrapper :path="mdiShieldAccountOutline" /> </template> <template #counter> <NcCounterBubble v-if="adminGroup && adminGroup.count > 0" @@ -70,7 +70,7 @@ :name="t('settings', 'Disabled accounts')" :to="{ name: 'group', params: { selectedGroup: 'disabled' } }"> <template #icon> - <NcIconSvgWrapper :path="mdiAccountOff" /> + <NcIconSvgWrapper :path="mdiAccountOffOutline" /> </template> <template v-if="disabledGroup.usercount > 0" #counter> <NcCounterBubble :type="selectedGroupDecoded === 'disabled' ? 'highlighted' : undefined"> @@ -87,7 +87,7 @@ type="tertiary" @click="isDialogOpen = true"> <template #icon> - <NcIconSvgWrapper :path="mdiCog" /> + <NcIconSvgWrapper :path="mdiCogOutline" /> </template> {{ t('settings', 'Account management settings') }} </NcButton> @@ -97,7 +97,7 @@ </template> <script setup lang="ts"> -import { mdiAccount, mdiAccountOff, mdiCog, mdiPlus, mdiShieldAccount, mdiHistory } from '@mdi/js' +import { mdiAccountOutline, mdiAccountOffOutline, mdiCogOutline, mdiPlus, mdiShieldAccountOutline, mdiHistory } from '@mdi/js' import { translate as t } from '@nextcloud/l10n' import { computed, ref } from 'vue' |