Skip to content

Commit 1f394cb

Browse files
Merge pull request #47687 from nextcloud/backport/29/ui-group-mgr
[stable29] fix(settings): Hide forbidden UI elements for group managers
2 parents 026efba + 679a472 commit 1f394cb

6 files changed

Lines changed: 23 additions & 12 deletions

apps/settings/src/components/UserList.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,16 @@ export default {
372372
},
373373
374374
setNewUserDefaultGroup(value) {
375-
if (value && value.length > 0) {
375+
// Is no value set, but user is a line manager we set their group as this is a requirement for line manager
376+
if (!value && !this.settings.isAdmin && !this.settings.isDelegatedAdmin) {
377+
// if there are multiple groups we do not know which to add,
378+
// so we cannot make the managers life easier by preselecting it.
379+
if (this.groups.length === 1) {
380+
value = this.groups[0].id
381+
}
382+
}
383+
384+
if (value) {
376385
// setting new account default group to the current selected one
377386
const currentGroup = this.groups.find(group => group.id === value)
378387
if (currentGroup) {

apps/settings/src/views/UserManagementNavigation.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</template>
2727
</NcAppNavigationItem>
2828

29-
<NcAppNavigationItem v-if="isAdmin"
29+
<NcAppNavigationItem v-if="settings.isAdmin"
3030
id="admin"
3131
:exact="true"
3232
:name="t('settings', 'Admins')"
@@ -65,11 +65,11 @@
6565
force-menu
6666
is-heading
6767
:open.sync="isAddGroupOpen">
68-
<template #actionsTriggerIcon>
68+
<template v-if="isAdminOrDelegatedAdmin" #actionsTriggerIcon>
6969
<NcLoadingIcon v-if="loadingAddGroup" />
7070
<NcIconSvgWrapper v-else :path="mdiPlus" />
7171
</template>
72-
<template #actions>
72+
<template v-if="isAdminOrDelegatedAdmin" #actions>
7373
<NcActionText>
7474
<template #icon>
7575
<AccountGroup :size="20" />
@@ -152,8 +152,10 @@ const userCount = computed(() => store.getters.getUserCount)
152152
const groups = computed(() => store.getters.getSortedGroups)
153153
const { adminGroup, disabledGroup, userGroups } = useFormatGroups(groups)
154154
155-
/** True if the current user is an administrator */
156-
const isAdmin = computed(() => store.getters.getServerData.isAdmin)
155+
/** Server settings for current user */
156+
const settings = computed(() => store.getters.getServerData)
157+
/** True if the current user is a (delegated) admin */
158+
const isAdminOrDelegatedAdmin = computed(() => settings.value.isAdmin || settings.value.isDelegatedAdmin)
157159
158160
/** True if the 'add-group' dialog is open - needed to be able to close it when the group is created */
159161
const isAddGroupOpen = ref(false)

dist/settings-users-3239.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-users-3239.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-vue-settings-apps-users-management.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-vue-settings-apps-users-management.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)