This is an automated email from the ASF dual-hosted git repository. machristie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
The following commit(s) were added to refs/heads/master by this push: new 7e6243d AIRAVATA-2931 Don't allow owner to be removed from group 7e6243d is described below commit 7e6243def93c8ed8db32631f60fcedf49cf67892 Author: Marcus Christie <machr...@iu.edu> AuthorDate: Mon Nov 19 15:09:39 2018 -0500 AIRAVATA-2931 Don't allow owner to be removed from group --- .../js/group_components/GroupMembersEditor.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/django_airavata/apps/groups/static/django_airavata_groups/js/group_components/GroupMembersEditor.vue b/django_airavata/apps/groups/static/django_airavata_groups/js/group_components/GroupMembersEditor.vue index e315424..e10a926 100644 --- a/django_airavata/apps/groups/static/django_airavata_groups/js/group_components/GroupMembersEditor.vue +++ b/django_airavata/apps/groups/static/django_airavata_groups/js/group_components/GroupMembersEditor.vue @@ -14,7 +14,9 @@ </div> </template> <template slot="role" slot-scope="data"> - <b-form-select v-if="group.isOwner" :value="data.item.role" @input="changeRole(data.item, $event)" :options="groupRoleOptions"> + <!-- Can only change role if the user is the group owner but the role of the owner can't be changed --> + <b-form-select v-if="group.isOwner && data.item.role !== 'OWNER'" :value="data.item.role" @input="changeRole(data.item, $event)" + :options="groupRoleOptions"> </b-form-select> <span v-else>{{ data.value }}</span> </template> @@ -102,15 +104,18 @@ export default { .map(m => { const userProfile = this.userProfilesMap[m]; const isAdmin = this.admins.indexOf(m) >= 0; + const isOwner = this.group.ownerId === m; // Owners can edit all members and admins can edit non-admin members + // (except the owners role isn't editable) const editable = - this.group.isOwner || (this.group.isAdmin && !isAdmin); + !isOwner && + (this.group.isOwner || (this.group.isAdmin && !isAdmin)); return { id: m, name: userProfile.firstName + " " + userProfile.lastName, username: userProfile.userId, email: userProfile.email, - role: isAdmin ? "ADMIN" : "MEMBER", + role: isOwner ? "OWNER" : isAdmin ? "ADMIN" : "MEMBER", editable: editable }; })