Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ff76f4a
perf(settings): Remove computation of all groups
Pytal Mar 25, 2025
8f10477
fix(settings): Fix infinitely loading account management page with pa…
Pytal Mar 25, 2025
5167b56
feat(provisioning_api): Add endpoint for fetching user groups with de…
Pytal Mar 25, 2025
f664eb8
perf(settings): Cancel request on new search
Pytal Mar 25, 2025
86e521d
fix(settings): Allow searching for groups in user row
Pytal Mar 25, 2025
328bb10
fix(settings): Allow searching for groups in new account dialog
Pytal Mar 25, 2025
c3dba3b
perf(settings): Make scrolling smooth when a large number of groups a…
Pytal Mar 25, 2025
1fbf26a
refactor(settings): Consolidate group formatting
Pytal Mar 25, 2025
537d68d
chore(settings): Add note on groups sorting
Pytal Mar 25, 2025
82cd9a2
fix(settings): Fix loaded groups being undefined
Pytal Mar 25, 2025
74b26f7
fix(settings): Prevent selection of invalid groups that are not fully…
Pytal Mar 25, 2025
ae390d2
fix(settings): Fix erroneous hiding of group admin column with pagina…
Pytal Mar 25, 2025
2cc7ebe
feat(provisioning_api): Add endpoint for fetching user subadmin group…
Pytal Mar 25, 2025
d3b8171
fix(settings): Fix editing groups and subadmin groups of user
Pytal Mar 25, 2025
21dbef7
fix(settings): Only change usercount if group can be found
Pytal Mar 25, 2025
91af8d1
fix(settings): Fix group creation when editing users
Pytal Mar 25, 2025
c022d2f
fix(settings): Fix group creation in new account dialog
Pytal Mar 25, 2025
42b7fda
fix(settings): Fix duplicated group options when editing account
Pytal Mar 25, 2025
a5e2c7d
fix(settings): Fix duplicated group options in new account dialog
Pytal Mar 25, 2025
75708f5
fix(settings): Natural order groups
Pytal Mar 25, 2025
368fcc3
fix(settings): Preserve system groups on reset
Pytal Mar 25, 2025
f1ed995
fix(settings): Fix initialization of store
Pytal Mar 25, 2025
3402b7c
fix(settings): Separate subadmin options
Pytal Mar 25, 2025
06af6de
test(settings): Wait until groups list has loaded
Pytal Mar 25, 2025
85dc4b4
test(settings): Correctly find group in select
Pytal Mar 25, 2025
58fc803
test(settings): Fix group items not being found
Pytal Mar 25, 2025
9cac821
chore(assets): Recompile assets
nextcloud-command Mar 28, 2025
fcd5da1
chore: Backport fixes
artonge Apr 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(settings): Allow searching for groups in new account dialog
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal authored and backportbot[bot] committed Apr 1, 2025
commit 328bb107aa998f917d21c09612636f2b2b16fbbf
53 changes: 32 additions & 21 deletions apps/settings/src/components/Users/NewUserDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,15 @@
:input-label="!settings.isAdmin && !settings.isDelegatedAdmin ? t('settings', 'Member of the following groups (required)') : t('settings', 'Member of the following groups')"
:placeholder="t('settings', 'Set account groups')"
:disabled="loading.groups || loading.all"
:options="canAddGroups"
:options="availableGroups"
:value="newUser.groups"
label="name"
:close-on-select="false"
:multiple="true"
:taggable="true"
:required="!settings.isAdmin && !settings.isDelegatedAdmin"
@input="handleGroupInput"
@search="searchGroups"
@option:created="createGroup" />
<!-- If user is not admin, he is a subadmin.
Subadmins can't create users outside their groups
Expand All @@ -83,10 +84,12 @@
class="dialog__select"
:input-label="t('settings', 'Admin of the following groups')"
:placeholder="t('settings', 'Set account as admin for …')"
:disabled="loading.groups || loading.all"
:options="subAdminsGroups"
:close-on-select="false"
:multiple="true"
label="name" />
label="name"
@search="searchGroups" />
</div>
<div class="dialog__item">
<NcSelect v-model="newUser.quota"
Expand Down Expand Up @@ -141,6 +144,9 @@ import NcPasswordField from '@nextcloud/vue/dist/Components/NcPasswordField.js'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'

import { searchGroups } from '../../service/groups.ts'
import { formatGroup } from '../../utils/groups.ts'

export default {
name: 'NewUserDialog',

Expand Down Expand Up @@ -171,11 +177,14 @@ export default {

data() {
return {
availableGroups: this.$store.getters.getSortedGroups.filter(group => group.id !== '__nc_internal_recent' && group.id !== 'disabled'),
possibleManagers: [],
// TRANSLATORS This string describes a manager in the context of an organization
managerInputLabel: t('settings', 'Manager'),
// TRANSLATORS This string describes a manager in the context of an organization
managerLabel: t('settings', 'Set line manager'),
// Cancelable promise for search groups request
promise: null,
}
},

Expand All @@ -199,27 +208,9 @@ export default {
return this.$store.getters.getPasswordPolicyMinLength
},

groups() {
// data provided php side + remove the recent and disabled groups
return this.$store.getters.getGroups
.filter(group => group.id !== '__nc_internal_recent' && group.id !== 'disabled')
.sort((a, b) => a.name.localeCompare(b.name))
},

subAdminsGroups() {
// data provided php side
return this.$store.getters.getSubadminGroups
},

canAddGroups() {
// disabled if no permission to add new users to group
return this.groups.map(group => {
// clone object because we don't want
// to edit the original groups
group = Object.assign({}, group)
group.$isDisabled = group.canAdd === false
return group
})
return this.availableGroups.filter(group => group.id !== 'admin' && group.id !== '__nc_internal_recent' && group.id !== 'disabled')
},

languages() {
Expand Down Expand Up @@ -289,6 +280,26 @@ export default {
this.newUser.groups = groups.filter(group => Boolean(group.id))
},

async searchGroups(query, toggleLoading) {
if (this.promise) {
this.promise.cancel()
}
toggleLoading(true)
try {
this.promise = searchGroups({
search: query,
offset: 0,
limit: 25,
})
const groups = (await this.promise).data.ocs?.data?.groups ?? []
this.availableGroups = groups.map(formatGroup)
} catch (error) {
logger.error(t('settings', 'Failed to search groups'), { error })
}
this.promise = null
toggleLoading(false)
},

/**
* Create a new group
*
Expand Down