aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/src/components/UserList.vue
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/src/components/UserList.vue')
-rw-r--r--apps/settings/src/components/UserList.vue126
1 files changed, 59 insertions, 67 deletions
diff --git a/apps/settings/src/components/UserList.vue b/apps/settings/src/components/UserList.vue
index 92c823e8bc5..459548fad26 100644
--- a/apps/settings/src/components/UserList.vue
+++ b/apps/settings/src/components/UserList.vue
@@ -1,43 +1,25 @@
<!--
- - @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
- -
- - @author John Molakvoæ <skjnldsv@protonmail.com>
- -
- - @license GNU AGPL version 3 or any later version
- -
- - This program is free software: you can redistribute it and/or modify
- - it under the terms of the GNU Affero General Public License as
- - published by the Free Software Foundation, either version 3 of the
- - License, or (at your option) any later version.
- -
- - This program is distributed in the hope that it will be useful,
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - GNU Affero General Public License for more details.
- -
- - You should have received a copy of the GNU Affero General Public License
- - along with this program. If not, see <http://www.gnu.org/licenses/>.
- -
- -->
+ - SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ - SPDX-License-Identifier: AGPL-3.0-or-later
+-->
<template>
<Fragment>
- <NewUserModal v-if="showConfig.showNewUserForm"
+ <NewUserDialog v-if="showConfig.showNewUserForm"
:loading="loading"
:new-user="newUser"
:quota-options="quotaOptions"
@reset="resetForm"
- @close="closeModal" />
+ @closing="closeDialog" />
<NcEmptyContent v-if="filteredUsers.length === 0"
class="empty"
- :name="isInitialLoad && loading.users ? null : t('settings', 'No users')">
+ :name="isInitialLoad && loading.users ? null : t('settings', 'No accounts')">
<template #icon>
<NcLoadingIcon v-if="isInitialLoad && loading.users"
- :name="t('settings', 'Loading users …')"
+ :name="t('settings', 'Loading accounts …')"
:size="64" />
- <NcIconSvgWrapper v-else
- :svg="usersSvg" />
+ <NcIconSvgWrapper v-else :path="mdiAccountGroupOutline" :size="64" />
</template>
</NcEmptyContent>
@@ -52,8 +34,6 @@
users,
settings,
hasObfuscated,
- groups,
- subAdminsGroups,
quotaOptions,
languages,
externalActions,
@@ -61,7 +41,7 @@
@scroll-end="handleScrollEnd">
<template #before>
<caption class="hidden-visually">
- {{ t('settings', 'List of users. This list is not fully rendered for performance reasons. The users will be rendered as you navigate through the list.') }}
+ {{ t('settings', 'List of accounts. This list is not fully rendered for performance reasons. The accounts will be rendered as you navigate through the list.') }}
</caption>
</template>
@@ -78,28 +58,26 @@
</template>
<script>
-import Vue from 'vue'
+import { mdiAccountGroupOutline } from '@mdi/js'
+import { showError } from '@nextcloud/dialogs'
+import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { Fragment } from 'vue-frag'
-import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
-import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
-import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
-
-import { subscribe, unsubscribe } from '@nextcloud/event-bus'
-import { showError } from '@nextcloud/dialogs'
+import Vue from 'vue'
+import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent'
+import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
+import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
import VirtualList from './Users/VirtualList.vue'
-import NewUserModal from './Users/NewUserModal.vue'
+import NewUserDialog from './Users/NewUserDialog.vue'
import UserListFooter from './Users/UserListFooter.vue'
import UserListHeader from './Users/UserListHeader.vue'
import UserRow from './Users/UserRow.vue'
import { defaultQuota, isObfuscated, unlimitedQuota } from '../utils/userUtils.ts'
-import logger from '../logger.js'
-
-import usersSvg from '../../img/users.svg?raw'
+import logger from '../logger.ts'
-const newUser = {
+const newUser = Object.freeze({
id: '',
displayName: '',
password: '',
@@ -112,7 +90,7 @@ const newUser = {
code: 'en',
name: t('settings', 'Default language'),
},
-}
+})
export default {
name: 'UserList',
@@ -122,7 +100,7 @@ export default {
NcEmptyContent,
NcIconSvgWrapper,
NcLoadingIcon,
- NewUserModal,
+ NewUserDialog,
UserListFooter,
UserListHeader,
VirtualList,
@@ -139,19 +117,26 @@ export default {
},
},
- data() {
+ setup() {
+ // non reactive properties
return {
+ mdiAccountGroupOutline,
+ rowHeight: 55,
+
UserRow,
+ }
+ },
+
+ data() {
+ return {
loading: {
all: false,
groups: false,
users: false,
},
+ newUser: { ...newUser },
isInitialLoad: true,
- rowHeight: 55,
- usersSvg,
searchQuery: '',
- newUser: Object.assign({}, newUser),
}
},
@@ -182,23 +167,12 @@ export default {
if (this.selectedGroup === 'disabled') {
return this.users.filter(user => user.enabled === false)
}
- if (!this.settings.isAdmin) {
- // we don't want subadmins to edit themselves
- return this.users.filter(user => user.enabled !== false)
- }
return this.users.filter(user => user.enabled !== false)
},
groups() {
- // data provided php side + remove the disabled group
- return this.$store.getters.getGroups
- .filter(group => group.id !== 'disabled')
- .sort((a, b) => a.name.localeCompare(b.name))
- },
-
- subAdminsGroups() {
- // data provided php side
- return this.$store.getters.getSubadminGroups
+ return this.$store.getters.getSortedGroups
+ .filter(group => group.id !== '__nc_internal_recent' && group.id !== 'disabled')
},
quotaOptions() {
@@ -252,7 +226,7 @@ export default {
watch: {
// watch url change and group select
- async selectedGroup(val, old) {
+ async selectedGroup(val) {
this.isInitialLoad = true
// if selected is the disabled group but it's empty
await this.redirectIfDisabled()
@@ -309,6 +283,13 @@ export default {
await this.$store.dispatch('getDisabledUsers', {
offset: this.disabledUsersOffset,
limit: this.disabledUsersLimit,
+ search: this.searchQuery,
+ })
+ } else if (this.selectedGroup === '__nc_internal_recent') {
+ await this.$store.dispatch('getRecentUsers', {
+ offset: this.usersOffset,
+ limit: this.usersLimit,
+ search: this.searchQuery,
})
} else {
await this.$store.dispatch('getUsers', {
@@ -320,14 +301,14 @@ export default {
}
logger.debug(`${this.users.length} total user(s) loaded`)
} catch (error) {
- logger.error('Failed to load users', { error })
- showError('Failed to load users')
+ logger.error('Failed to load accounts', { error })
+ showError('Failed to load accounts')
}
this.loading.users = false
this.isInitialLoad = false
},
- closeModal() {
+ closeDialog() {
this.$store.commit('setShowConfig', {
key: 'showNewUserForm',
value: false,
@@ -367,8 +348,19 @@ export default {
},
setNewUserDefaultGroup(value) {
- if (value && value.length > 0) {
- // setting new user default group to the current selected one
+ // Is no value set, but user is a line manager we set their group as this is a requirement for line manager
+ if (!value && !this.settings.isAdmin && !this.settings.isDelegatedAdmin) {
+ const groups = this.$store.getters.getSubAdminGroups
+ // if there are multiple groups we do not know which to add,
+ // so we cannot make the managers life easier by preselecting it.
+ if (groups.length === 1) {
+ this.newUser.groups = [...groups]
+ }
+ return
+ }
+
+ if (value) {
+ // setting new account default group to the current selected one
const currentGroup = this.groups.find(group => group.id === value)
if (currentGroup) {
this.newUser.groups = [currentGroup]
@@ -399,7 +391,7 @@ export default {
</script>
<style lang="scss" scoped>
-@import './Users/shared/styles.scss';
+@use './Users/shared/styles' as *;
.empty {
:deep {