diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-19 21:51:59 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-19 23:20:33 +0200 |
commit | a53dbb8c0b6c044b17604dfdd86b9ad951381c66 (patch) | |
tree | ef2e23bf0203ab737e11fb8315981605c6cbc31b /settings/src/components | |
parent | 8a1cbbd90e73b44f1884b4a65fe4c55d40d377e9 (diff) | |
download | nextcloud-server-a53dbb8c0b6c044b17604dfdd86b9ad951381c66.tar.gz nextcloud-server-a53dbb8c0b6c044b17604dfdd86b9ad951381c66.zip |
New user support, provisionning api and design fixes
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/src/components')
-rw-r--r-- | settings/src/components/userList.vue | 14 | ||||
-rw-r--r-- | settings/src/components/userList/userRow.vue | 19 |
2 files changed, 30 insertions, 3 deletions
diff --git a/settings/src/components/userList.vue b/settings/src/components/userList.vue index a2d470745f9..14553c0ddc6 100644 --- a/settings/src/components/userList.vue +++ b/settings/src/components/userList.vue @@ -75,7 +75,7 @@ <!-- hidden input trick for vanilla html5 form validation --> <input type="text" :value="newUser.groups" v-if="!settings.isAdmin" tabindex="-1" id="newgroups" :required="!settings.isAdmin" /> - <multiselect :options="groups" v-model="newUser.groups" + <multiselect :options="canAddGroups" v-model="newUser.groups" :placeholder="t('settings', 'Add user in group')" label="name" track-by="id" class="multiselect-vue" :multiple="true" :close-on-select="false" @@ -202,7 +202,7 @@ export default { return disabledUsers; } if (!this.settings.isAdmin) { - // We don't want subadmins to edit themselves + // we don't want subadmins to edit themselves return this.users.filter(user => user.enabled !== false && user.id !== oc_current_user); } return this.users.filter(user => user.enabled !== false); @@ -213,6 +213,16 @@ export default { .filter(group => group.id !== 'disabled') .sort((a, b) => a.name.localeCompare(b.name)); }, + 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 !== true; + return group; + }); + }, subAdminsGroups() { // data provided php side return this.$store.getters.getSubadminGroups; diff --git a/settings/src/components/userList/userRow.vue b/settings/src/components/userList/userRow.vue index aaf5d9474f4..22439b32cb9 100644 --- a/settings/src/components/userList/userRow.vue +++ b/settings/src/components/userList/userRow.vue @@ -64,7 +64,7 @@ <input type="submit" class="icon-confirm" value="" /> </form> <div class="groups" :class="{'icon-loading-small': loading.groups}"> - <multiselect :value="userGroups" :options="groups" :disabled="loading.groups||loading.all" + <multiselect :value="userGroups" :options="availableGroups" :disabled="loading.groups||loading.all" tag-placeholder="create" :placeholder="t('settings', 'Add user in group')" label="name" track-by="id" class="multiselect-vue" :limit="2" :multiple="true" :taggable="settings.isAdmin" :closeOnSelect="false" @@ -182,6 +182,23 @@ export default { let 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 + let 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 !== true && + !this.user.groups.includes(group.id)) || + (group.canRemove !== true && + this.user.groups.includes(group.id)); + return groupClone; + }); + }, /* QUOTA MANAGEMENT */ usedQuota() { |