diff options
Diffstat (limited to 'apps/settings/src/mixins/UserRowMixin.js')
-rw-r--r-- | apps/settings/src/mixins/UserRowMixin.js | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/apps/settings/src/mixins/UserRowMixin.js b/apps/settings/src/mixins/UserRowMixin.js index 984607ef3d3..9e46d8e25d7 100644 --- a/apps/settings/src/mixins/UserRowMixin.js +++ b/apps/settings/src/mixins/UserRowMixin.js @@ -16,14 +16,6 @@ export default { type: Object, default: () => ({}), }, - groups: { - type: Array, - default: () => [], - }, - subAdminsGroups: { - type: Array, - default: () => [], - }, quotaOptions: { type: Array, default: () => [], @@ -49,38 +41,19 @@ export default { formattedFullTime, } }, + data() { + return { + 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 })), + } + }, computed: { showConfig() { return this.$store.getters.getShowConfig }, - /* GROUPS MANAGEMENT */ - userGroups() { - const userGroups = this.groups.filter(group => this.user.groups.includes(group.id)) - return userGroups - }, - userSubAdminsGroups() { - const userSubAdminsGroups = this.subAdminsGroups.filter(group => this.user.subadmin.includes(group.id)) - return userSubAdminsGroups - }, - availableGroups() { - return this.groups.map((group) => { - // clone object because we don't want - // to edit the original groups - const groupClone = Object.assign({}, group) - - // two settings here: - // 1. user NOT in group but no permission to add - // 2. user is in group but no permission to remove - groupClone.$isDisabled - = (group.canAdd === false - && !this.user.groups.includes(group.id)) - || (group.canRemove === false - && this.user.groups.includes(group.id)) - return groupClone - }) - }, - /* QUOTA MANAGEMENT */ usedSpace() { const quotaUsed = this.user.quota.used > 0 ? this.user.quota.used : 0 |