From commits-return-19451-archive-asf-public=cust-asf.ponee.io@airavata.apache.org Fri Jul 13 02:18:08 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 8D7E71807A1 for ; Fri, 13 Jul 2018 02:18:07 +0200 (CEST) Received: (qmail 49721 invoked by uid 500); 13 Jul 2018 00:18:06 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 49705 invoked by uid 99); 13 Jul 2018 00:18:06 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jul 2018 00:18:06 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 8B72681E3D; Fri, 13 Jul 2018 00:18:05 +0000 (UTC) Date: Fri, 13 Jul 2018 00:18:11 +0000 To: "commits@airavata.apache.org" Subject: [airavata-django-portal] 06/07: AIRAVATA-2835 Auto add default Gateway Users group to sharing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: machristie@apache.org In-Reply-To: <153144108537.6235.13356119512610193257@gitbox.apache.org> References: <153144108537.6235.13356119512610193257@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: airavata-django-portal X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: 994562c9b45d41cafed2cc9f0165b661bb861889 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20180713001805.8B72681E3D@gitbox.apache.org> 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 commit 994562c9b45d41cafed2cc9f0165b661bb861889 Author: Marcus Christie AuthorDate: Thu Jul 12 20:10:42 2018 -0400 AIRAVATA-2835 Auto add default Gateway Users group to sharing --- .../static/common/js/components/ShareButton.vue | 40 ++++++++++++++++------ 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/django_airavata/static/common/js/components/ShareButton.vue b/django_airavata/static/common/js/components/ShareButton.vue index fbb4097..ff2e7a4 100644 --- a/django_airavata/static/common/js/components/ShareButton.vue +++ b/django_airavata/static/common/js/components/ShareButton.vue @@ -8,7 +8,8 @@ ref="modalSharingSettings" ok-title="Save" @ok="saveSharedEntity" @cancel="cancelEditSharedEntity" no-close-on-esc no-close-on-backdrop hide-header-close - :ok-disabled="loading" :cancel-disabled="loading"> + :ok-disabled="loading" :cancel-disabled="loading" + @show="showSharingSettingsModal"> {{errorMessage}} group.id === suggestion.id); - if (!this.sharedEntity.groupPermissions) { - this.sharedEntity.groupPermissions = []; - } - this.sharedEntity.groupPermissions.push(new models.GroupPermission({ - 'group': group, - 'permissionType': models.ResourcePermissionType.READ - })); + this.addGroup(group); } else if (suggestion.type === 'user') { const user = this.users.find(user => user.airavataInternalUserId === suggestion.id); if (!this.sharedEntity.userPermissions) { @@ -205,6 +204,15 @@ export default { })); } }, + addGroup: function(group) { + if (!this.sharedEntity.groupPermissions) { + this.sharedEntity.groupPermissions = []; + } + this.sharedEntity.groupPermissions.push(new models.GroupPermission({ + 'group': group, + 'permissionType': models.ResourcePermissionType.READ + })); + }, saveSharedEntity: function(event) { // If entity hasn't been persisted yet then just emitValueChanged. // Sharing settings will need to be saved later (see mergeAndSave). @@ -230,7 +238,7 @@ export default { }, cancelEditSharedEntity: function(event) { this.errorMessage = null; - this.sharedEntity = this.cloneSharedEntity(this.value); + this.sharedEntity = this.sharedEntityCopy; }, emitValueChanged: function() { this.$emit('input', this.sharedEntity); @@ -238,10 +246,20 @@ export default { cloneSharedEntity: function(sharedEntity) { return sharedEntity ? sharedEntity.clone() : new models.SharedEntity(); }, + showSharingSettingsModal: function(event) { + this.sharedEntityCopy = this.cloneSharedEntity(this.sharedEntity); + } }, mounted: function() { // Load all of the groups and users - services.ServiceFactory.service("Groups").list({limit: -1}).then(groups => this.groups = groups); + services.ServiceFactory.service("Groups").list({limit: -1}) + .then(groups => { + this.groups = groups; + // If a new sharedEntity, automatically add the defaultGatewayUsersGroup + if (!this.sharedEntity.entityId && this.autoAddDefaultGatewayUsersGroup) { + this.groups.filter(group => group.isDefaultGatewayUsersGroup).forEach(this.addGroup); + } + }); services.ServiceFactory.service("UserProfiles").list().then(users => this.users = users); }, watch: {