1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
<!--
- SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<NcAppContent :page-heading="pageHeading">
<UserList :selected-group="selectedGroupDecoded"
:external-actions="externalActions" />
</NcAppContent>
</template>
<script>
import { translate as t } from '@nextcloud/l10n'
import { defineComponent } from 'vue'
import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent.js'
import UserList from '../components/UserList.vue'
export default defineComponent({
name: 'UserManagement',
components: {
NcAppContent,
UserList,
},
data() {
return {
// temporary value used for multiselect change
externalActions: [],
}
},
computed: {
pageHeading() {
if (this.selectedGroupDecoded === null) {
return t('settings', 'Active accounts')
}
const matchHeading = {
admin: t('settings', 'Admins'),
disabled: t('settings', 'Disabled accounts'),
}
return matchHeading[this.selectedGroupDecoded] ?? t('settings', 'Account group: {group}', { group: this.selectedGroupDecoded })
},
selectedGroup() {
return this.$route.params.selectedGroup
},
selectedGroupDecoded() {
return this.selectedGroup ? decodeURIComponent(this.selectedGroup) : null
},
},
beforeMount() {
this.$store.commit('initGroups', {
groups: this.$store.getters.getServerData.groups,
orderBy: this.$store.getters.getServerData.sortGroups,
userCount: this.$store.getters.getServerData.userCount,
})
this.$store.dispatch('getPasswordPolicyMinLength')
},
created() {
// init the OCA.Settings.UserList object
window.OCA = window.OCA ?? {}
window.OCA.Settings = window.OCA.Settings ?? {}
window.OCA.Settings.UserList = window.OCA.Settings.UserList ?? {}
// and add the registerAction method
window.OCA.Settings.UserList.registerAction = this.registerAction
},
methods: {
t,
/**
* Register a new action for the user menu
*
* @param {string} icon the icon class
* @param {string} text the text to display
* @param {Function} action the function to run
* @return {Array}
*/
registerAction(icon, text, action) {
this.externalActions.push({
icon,
text,
action,
})
return this.externalActions
},
},
})
</script>
<style lang="scss" scoped>
.app-content {
// Virtual list needs to be full height and is scrollable
display: flex;
overflow: hidden;
flex-direction: column;
max-height: 100%;
}
</style>
|