You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/07/25 14:48:04 UTC
[airavata-django-portal] branch master updated (078d1ab -> 055b441)
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git.
from 078d1ab AIRAVATA-3180 Fix bug with displaying notifications
new 6b5f885 AIRAVATA-3177 Disable new deployment button for readonly admin
new 4384887 AIRAVATA-3177 Allow Read Only admins to see user mgmt screen
new 4dfc845 AIRAVATA-3177 Allow readonly admins to see gateway resource profile
new 7879497 AIRAVATA-3162 Pinning bootstrap-vue dependency to 2.0.0-rc.26
new 055b441 AIRAVATA-3162 Remove unnecessary use of b-link
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
django_airavata/apps/admin/apps.py | 6 ++++--
django_airavata/apps/admin/package.json | 2 +-
.../applications/ApplicationDeploymentsList.vue | 8 ++++++--
.../applications/ApplicationEditorContainer.vue | 2 +-
.../src/components/credentials/SSHCredentialSelector.vue | 8 ++++++--
.../gatewayprofile/GatewayResourceProfileEditor.vue | 2 +-
.../GatewayResourceProfileEditorContainer.vue | 6 ++----
.../components/gatewayprofile/StoragePreferenceList.vue | 10 +++++++---
.../users/IdentityServiceUserManagementContainer.vue | 2 +-
.../users/UnverifiedEmailUserManagementContainer.vue | 2 +-
django_airavata/apps/api/serializers.py | 15 +++++++++++++++
.../js/models/GatewayResourceProfile.js | 3 ++-
.../django_airavata_api/js/models/IAMUserProfile.js | 5 +++--
.../js/models/UnverifiedEmailUserProfile.js | 1 +
django_airavata/apps/api/view_utils.py | 9 +++++++--
django_airavata/apps/dataparsers/package.json | 2 +-
django_airavata/apps/groups/package.json | 2 +-
django_airavata/apps/workspace/package.json | 2 +-
.../static/common/js/components/ClipboardCopyLink.vue | 4 ++--
django_airavata/static/common/js/layouts/ListLayout.vue | 6 +++++-
django_airavata/static/common/package.json | 2 +-
docs/dev/new_django_app.md | 2 +-
22 files changed, 70 insertions(+), 31 deletions(-)
[airavata-django-portal] 05/05: AIRAVATA-3162 Remove unnecessary
use of b-link
Posted by ma...@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 055b441407e01770bc49b401e2c2193c583f7f11
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jul 25 10:47:42 2019 -0400
AIRAVATA-3162 Remove unnecessary use of b-link
b-link changed from a functional to a regular Vue
component in 2.0.0-rc.26 which changes to get a
reference to its element ($el) which is needed to
integrate the Clipboard library with the link. Since b-link
isn't really needed, I switched it to just a regular a tag.
---
django_airavata/static/common/js/components/ClipboardCopyLink.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/django_airavata/static/common/js/components/ClipboardCopyLink.vue b/django_airavata/static/common/js/components/ClipboardCopyLink.vue
index f50914f..1d5e894 100644
--- a/django_airavata/static/common/js/components/ClipboardCopyLink.vue
+++ b/django_airavata/static/common/js/components/ClipboardCopyLink.vue
@@ -1,13 +1,13 @@
<template>
<div style="display: inline-block">
- <b-link ref="copyLink" :data-clipboard-text="text" class="action-link" :class="linkClasses">
+ <a href="#" ref="copyLink" :data-clipboard-text="text" class="action-link" :class="linkClasses">
<slot>
Copy Key
</slot>
<slot name="icon">
<i class="far fa-clipboard"></i>
</slot>
- </b-link>
+ </a>
<b-tooltip :show="show" :disabled="!show" :target="() => $refs.copyLink">
<slot name="tooltip">Copied!</slot>
</b-tooltip>
[airavata-django-portal] 01/05: AIRAVATA-3177 Disable new
deployment button for readonly admin
Posted by ma...@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 6b5f885fc14bea93165f872e1d0b85230641dbce
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Jul 24 11:22:33 2019 -0400
AIRAVATA-3177 Disable new deployment button for readonly admin
---
.../src/components/applications/ApplicationDeploymentsList.vue | 8 ++++++--
.../src/components/applications/ApplicationEditorContainer.vue | 2 +-
django_airavata/static/common/js/layouts/ListLayout.vue | 6 +++++-
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationDeploymentsList.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationDeploymentsList.vue
index 0ea4fab..4fcfbdb 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationDeploymentsList.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationDeploymentsList.vue
@@ -1,6 +1,6 @@
<template>
<div>
- <list-layout @add-new-item="newApplicationDeployment" :items="deployments" title="Application Deployments" new-item-button-text="New Deployment">
+ <list-layout @add-new-item="newApplicationDeployment" :items="deployments" title="Application Deployments" new-item-button-text="New Deployment" :new-button-disabled="readonly">
<template slot="item-list" slot-scope="slotProps">
<b-table striped hover :fields="fields" :items="slotProps.items" sort-by="computeHostId">
@@ -50,7 +50,11 @@ export default {
// app module id
type: String,
required: true
- }
+ },
+ readonly: {
+ type: Boolean,
+ default: false
+ },
},
data() {
return {
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue
index c7a7400..e1eb75b 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue
@@ -22,7 +22,7 @@
:validation-errors="appModuleValidationErrors" />
<router-view name="interface" v-if="appInterface" v-model="appInterface" @input="appInterfaceIsDirty = true" :readonly="!appInterface.userHasWriteAccess"
/>
- <router-view name="deployments" v-if="appDeployments" :deployments="appDeployments" @new="createNewDeployment" @delete="deleteApplicationDeployment"
+ <router-view name="deployments" v-if="appModule && appDeployments" :deployments="appDeployments" @new="createNewDeployment" @delete="deleteApplicationDeployment" :readonly="!appModule.userHasWriteAccess"
/>
<router-view name="deployment" v-if="currentDeployment && currentDeploymentSharedEntity" v-model="currentDeployment" :shared-entity="currentDeploymentSharedEntity"
@sharing-changed="deploymentSharingChanged" @input="currentDeploymentChanged" />
diff --git a/django_airavata/static/common/js/layouts/ListLayout.vue b/django_airavata/static/common/js/layouts/ListLayout.vue
index 69f5bbf..d94628f 100644
--- a/django_airavata/static/common/js/layouts/ListLayout.vue
+++ b/django_airavata/static/common/js/layouts/ListLayout.vue
@@ -8,7 +8,7 @@
</div>
<div class="col-auto">
<slot name="new-item-button">
- <b-btn variant="primary" @click="addNewItem">
+ <b-btn variant="primary" @click="addNewItem" :disabled="newButtonDisabled">
{{ newItemButtonText }}
<i class="fa fa-plus" aria-hidden="true"></i>
</b-btn>
@@ -52,6 +52,10 @@ export default {
newItemButtonText: {
type: String,
default: "New Item"
+ },
+ newButtonDisabled: {
+ type: Boolean,
+ default: false
}
},
name: "list-layout",
[airavata-django-portal] 04/05: AIRAVATA-3162 Pinning bootstrap-vue
dependency to 2.0.0-rc.26
Posted by ma...@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 7879497900e514716fcacec787490dacee6b087f
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jul 25 10:44:04 2019 -0400
AIRAVATA-3162 Pinning bootstrap-vue dependency to 2.0.0-rc.26
---
django_airavata/apps/admin/package.json | 2 +-
django_airavata/apps/dataparsers/package.json | 2 +-
django_airavata/apps/groups/package.json | 2 +-
django_airavata/apps/workspace/package.json | 2 +-
django_airavata/static/common/package.json | 2 +-
docs/dev/new_django_app.md | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/django_airavata/apps/admin/package.json b/django_airavata/apps/admin/package.json
index f8c3e6d..80f5f16 100644
--- a/django_airavata/apps/admin/package.json
+++ b/django_airavata/apps/admin/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"bootstrap": "^4.3.1",
- "bootstrap-vue": "^2.0.0-rc.22",
+ "bootstrap-vue": "2.0.0-rc.26",
"django-airavata-api": "file:../api",
"django-airavata-common-ui": "file:../../static/common",
"moment": "^2.22.2",
diff --git a/django_airavata/apps/dataparsers/package.json b/django_airavata/apps/dataparsers/package.json
index e3decaa..0bd108c 100644
--- a/django_airavata/apps/dataparsers/package.json
+++ b/django_airavata/apps/dataparsers/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"bootstrap": "^4.1.3",
- "bootstrap-vue": "^2.0.0-rc.11",
+ "bootstrap-vue": "2.0.0-rc.26",
"django-airavata-api": "file:../api",
"django-airavata-common-ui": "file:../../static/common",
"terser": "^4.1.2",
diff --git a/django_airavata/apps/groups/package.json b/django_airavata/apps/groups/package.json
index 68958d2..da637c7 100755
--- a/django_airavata/apps/groups/package.json
+++ b/django_airavata/apps/groups/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"bootstrap": "^4.0.0-beta.2",
- "bootstrap-vue": "^2.0.0-rc.26",
+ "bootstrap-vue": "2.0.0-rc.26",
"django-airavata-api": "file:../api",
"django-airavata-common-ui": "file:../../static/common",
"moment": "^2.18.1",
diff --git a/django_airavata/apps/workspace/package.json b/django_airavata/apps/workspace/package.json
index 97d4e64..4d4fc92 100644
--- a/django_airavata/apps/workspace/package.json
+++ b/django_airavata/apps/workspace/package.json
@@ -15,7 +15,7 @@
},
"dependencies": {
"bootstrap": "^4.3.1",
- "bootstrap-vue": "^2.0.0-rc.20",
+ "bootstrap-vue": "2.0.0-rc.26",
"django-airavata-api": "file:../api",
"django-airavata-common-ui": "file:../../static/common",
"django-airavata-workspace-plugin-api": "file:django-airavata-workspace-plugin-api",
diff --git a/django_airavata/static/common/package.json b/django_airavata/static/common/package.json
index 024b036..13810b9 100644
--- a/django_airavata/static/common/package.json
+++ b/django_airavata/static/common/package.json
@@ -15,7 +15,7 @@
"dependencies": {
"@fortawesome/fontawesome-free": "^5.6.3",
"bootstrap": "^4.3.1",
- "bootstrap-vue": "^2.0.0-rc.11",
+ "bootstrap-vue": "2.0.0-rc.26",
"clipboard": "^2.0.4",
"django-airavata-api": "file:../../apps/api",
"jquery": "^3.3.1",
diff --git a/docs/dev/new_django_app.md b/docs/dev/new_django_app.md
index 5bd166b..21c2a89 100644
--- a/docs/dev/new_django_app.md
+++ b/docs/dev/new_django_app.md
@@ -234,7 +234,7 @@ django_airavata/apps/myapp):
},
"dependencies": {
"bootstrap": "^4.0.0-beta.2",
- "bootstrap-vue": "^1.4.1",
+ "bootstrap-vue": "2.0.0-rc.26",
"django-airavata-api": "file:../api",
"django-airavata-common-ui": "file:../../static/common",
"vue": "^2.5.21"
[airavata-django-portal] 02/05: AIRAVATA-3177 Allow Read Only
admins to see user mgmt screen
Posted by ma...@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 43848871c7d55bc633352733af55acd99cac73a0
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Jul 24 11:38:00 2019 -0400
AIRAVATA-3177 Allow Read Only admins to see user mgmt screen
---
django_airavata/apps/admin/apps.py | 3 ++-
.../users/IdentityServiceUserManagementContainer.vue | 2 +-
.../users/UnverifiedEmailUserManagementContainer.vue | 2 +-
django_airavata/apps/api/serializers.py | 10 ++++++++++
.../api/static/django_airavata_api/js/models/IAMUserProfile.js | 5 +++--
.../js/models/UnverifiedEmailUserProfile.js | 1 +
django_airavata/apps/api/view_utils.py | 9 +++++++--
7 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/django_airavata/apps/admin/apps.py b/django_airavata/apps/admin/apps.py
index d5d9b8b..91b3752 100644
--- a/django_airavata/apps/admin/apps.py
+++ b/django_airavata/apps/admin/apps.py
@@ -26,7 +26,8 @@ class AdminConfig(AiravataAppConfig):
'icon': 'fa fa-users',
'url': 'django_airavata_admin:users',
'active_prefixes': ['users'],
- 'enabled': lambda req: req.is_gateway_admin,
+ 'enabled': lambda req: (req.is_gateway_admin or
+ req.is_read_only_gateway_admin),
},
{
'label': 'Experiment Statistics',
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/IdentityServiceUserManagementContainer.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/IdentityServiceUserManagementContainer.vue
index 974468d..fc303d2 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/IdentityServiceUserManagementContainer.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/IdentityServiceUserManagementContainer.vue
@@ -47,7 +47,7 @@
slot="action"
slot-scope="data"
>
- <b-button @click="toggleDetails(data)">
+ <b-button v-if="data.item.userHasWriteAccess" @click="toggleDetails(data)">
Edit
</b-button>
</template>
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UnverifiedEmailUserManagementContainer.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UnverifiedEmailUserManagementContainer.vue
index 606346e..f3e82b2 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UnverifiedEmailUserManagementContainer.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UnverifiedEmailUserManagementContainer.vue
@@ -19,7 +19,7 @@
slot="action"
slot-scope="data"
>
- <b-button @click="toggleDetails(data)">
+ <b-button v-if="data.item.userHasWriteAccess" @click="toggleDetails(data)">
Edit
</b-button>
</template>
diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index 39d7d9c..5ba819d 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -893,6 +893,7 @@ class IAMUserProfile(serializers.Serializer):
view_name='django_airavata_api:iam-user-profile-detail',
lookup_field='userId',
lookup_url_kwarg='user_id')
+ userHasWriteAccess = serializers.SerializerMethodField()
def update(self, instance, validated_data):
existing_group_ids = [group.id for group in instance['groups']]
@@ -903,6 +904,10 @@ class IAMUserProfile(serializers.Serializer):
set(existing_group_ids) - set(new_group_ids))
return instance
+ def get_userHasWriteAccess(self, userProfile):
+ request = self.context['request']
+ return request.is_gateway_admin
+
class AckNotificationSerializer(serializers.ModelSerializer):
class Meta:
@@ -944,6 +949,11 @@ class UnverifiedEmailUserProfile(serializers.Serializer):
view_name='django_airavata_api:unverified-email-user-profile-detail',
lookup_field='userId',
lookup_url_kwarg='user_id')
+ userHasWriteAccess = serializers.SerializerMethodField()
+
+ def get_userHasWriteAccess(self, userProfile):
+ request = self.context['request']
+ return request.is_gateway_admin
class LogRecordSerializer(serializers.Serializer):
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/IAMUserProfile.js b/django_airavata/apps/api/static/django_airavata_api/js/models/IAMUserProfile.js
index 2b2e6f5..23d7dff 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/IAMUserProfile.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/IAMUserProfile.js
@@ -14,13 +14,14 @@ const FIELDS = [
"airavataUserProfileExists",
{
name: "creationTime",
- type: 'date',
+ type: "date"
},
{
name: "groups",
type: Group,
list: true
- }
+ },
+ "userHasWriteAccess"
];
export default class IAMUserProfile extends BaseModel {
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/UnverifiedEmailUserProfile.js b/django_airavata/apps/api/static/django_airavata_api/js/models/UnverifiedEmailUserProfile.js
index 1b1b59b..c190246 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/UnverifiedEmailUserProfile.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/UnverifiedEmailUserProfile.js
@@ -12,6 +12,7 @@ const FIELDS = [
name: "creationTime",
type: 'date',
},
+ "userHasWriteAccess"
];
export default class UnverifiedEmailUserProfile extends BaseModel {
diff --git a/django_airavata/apps/api/view_utils.py b/django_airavata/apps/api/view_utils.py
index 3ad0e34..7886ff3 100644
--- a/django_airavata/apps/api/view_utils.py
+++ b/django_airavata/apps/api/view_utils.py
@@ -197,7 +197,12 @@ def convert_utc_iso8601_to_date(iso8601_utc_string):
class IsInAdminsGroupPermission(permissions.BasePermission):
- message = "User must be member of the Admins group."
+ message = "User must be member of the Admins or Read Only Admins groups."
def has_permission(self, request, view):
- return request.is_gateway_admin
+ # Read Only Admins can make GET requests only
+ if request.method in permissions.SAFE_METHODS:
+ return (request.is_gateway_admin or
+ request.is_read_only_gateway_admin)
+ else:
+ return request.is_gateway_admin
[airavata-django-portal] 03/05: AIRAVATA-3177 Allow readonly admins
to see gateway resource profile
Posted by ma...@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 4dfc8458a51cc3c5e0596005719835ca1459cca6
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Jul 24 12:09:41 2019 -0400
AIRAVATA-3177 Allow readonly admins to see gateway resource profile
---
django_airavata/apps/admin/apps.py | 3 ++-
.../src/components/credentials/SSHCredentialSelector.vue | 8 ++++++--
.../components/gatewayprofile/GatewayResourceProfileEditor.vue | 2 +-
.../gatewayprofile/GatewayResourceProfileEditorContainer.vue | 6 ++----
.../src/components/gatewayprofile/StoragePreferenceList.vue | 10 +++++++---
django_airavata/apps/api/serializers.py | 5 +++++
.../django_airavata_api/js/models/GatewayResourceProfile.js | 3 ++-
7 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/django_airavata/apps/admin/apps.py b/django_airavata/apps/admin/apps.py
index 91b3752..5501733 100644
--- a/django_airavata/apps/admin/apps.py
+++ b/django_airavata/apps/admin/apps.py
@@ -54,7 +54,8 @@ class AdminConfig(AiravataAppConfig):
'icon': 'fa fa-tasks',
'url': 'django_airavata_admin:gateway_resource_profile',
'active_prefixes': ['gateway-resource-profile'],
- 'enabled': lambda req: req.is_gateway_admin
+ 'enabled': lambda req: (req.is_gateway_admin or
+ req.is_read_only_gateway_admin)
},
{
'label': 'Manage Notices',
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/credentials/SSHCredentialSelector.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/credentials/SSHCredentialSelector.vue
index ead1bb6..c9c6584 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/credentials/SSHCredentialSelector.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/credentials/SSHCredentialSelector.vue
@@ -1,7 +1,7 @@
<template>
<div>
<b-input-group>
- <b-form-select v-model="data" :options="credentialStoreTokenOptions">
+ <b-form-select v-model="data" :options="credentialStoreTokenOptions" :disabled="readonly">
<option v-if="nullOption" slot="first" :value="null" :disabled="nullOptionDisabled">
<slot name="null-option-label" :defaultCredentialSummary="defaultCredentialSummary">
<span v-if="defaultCredentialSummary">
@@ -16,7 +16,7 @@
<b-input-group-append>
<clipboard-copy-button variant="secondary" :text="copySSHPublicKeyText">
</clipboard-copy-button>
- <b-button variant="secondary" @click="showNewSSHCredentialModal">
+ <b-button v-if="!readonly" variant="secondary" @click="showNewSSHCredentialModal">
<i class="fa fa-plus"></i>
</b-button>
</b-input-group-append>
@@ -47,6 +47,10 @@ export default {
nullOptionDisabled: {
type: Boolean,
default: false
+ },
+ readonly: {
+ type: Boolean,
+ default: false
}
},
mixins: [mixins.VModelMixin],
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditor.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditor.vue
index 244bdb6..cb0ac76 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditor.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditor.vue
@@ -6,7 +6,7 @@
Gateway Resource Profile - {{ data.gatewayID }}
</h1>
<b-form-group label="Default SSH Credential" label-for="default-credential-store-token" description="This is the default SSH credential that will be used for storage preferences that don't specify their own SSH credential.">
- <ssh-credential-selector id="default-credential-store-token" v-model="data.credentialStoreToken"/>
+ <ssh-credential-selector id="default-credential-store-token" v-model="data.credentialStoreToken" :readonly="!data.userHasWriteAccess"/>
</b-form-group>
</div>
</div>
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditorContainer.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditorContainer.vue
index 3e827c0..949f30a 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditorContainer.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditorContainer.vue
@@ -15,12 +15,12 @@
<div class="card-body">
<storage-preference-list v-if="gatewayResourceProfile" :storagePreferences="gatewayResourceProfile.storagePreferences"
:default-credential-store-token="gatewayResourceProfile.credentialStoreToken" @updated="updatedStoragePreference"
- @added="addedStoragePreference" @delete="deleteStoragePreference" />
+ @added="addedStoragePreference" @delete="deleteStoragePreference" :readonly="!gatewayResourceProfile.userHasWriteAccess"/>
</div>
</div>
</div>
</div>
- <div class="row">
+ <div class="row" v-if="gatewayResourceProfile && gatewayResourceProfile.userHasWriteAccess">
<div class="col">
<b-button variant="primary" @click="save">
Save
@@ -36,14 +36,12 @@
<script>
import { services } from "django-airavata-api";
import GatewayResourceProfileEditor from "./GatewayResourceProfileEditor.vue";
-import StoragePreferenceEditor from "./StoragePreferenceEditor.vue";
import StoragePreferenceList from "./StoragePreferenceList.vue";
export default {
name: "gateway-resource-profile-editor-container",
components: {
GatewayResourceProfileEditor,
- StoragePreferenceEditor,
StoragePreferenceList
},
data() {
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
index 28df694..145d0e0 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
@@ -1,6 +1,6 @@
<template>
<list-layout @add-new-item="addNewStoragePreference" :items="decoratedStoragePreferences" title="Storage Preferences"
- new-item-button-text="New Storage Preference">
+ new-item-button-text="New Storage Preference" :new-button-disabled="readonly">
<template slot="new-item-editor">
<b-card v-if="showNewItemEditor" title="New Storage Preference">
<b-form-group label="Storage Resource" label-for="storage-resource">
@@ -29,11 +29,11 @@
</b-badge>
</template>
<template slot="action" slot-scope="data">
- <b-link class="action-link" @click="toggleDetails(data)">
+ <b-link v-if="!readonly" class="action-link" @click="toggleDetails(data)">
Edit
<i class="fa fa-edit" aria-hidden="true"></i>
</b-link>
- <delete-link @delete="deleteStoragePreference(data.item.storageResourceId)">
+ <delete-link v-if="!readonly" @delete="deleteStoragePreference(data.item.storageResourceId)">
Are you sure you want to delete the storage preference for {{ getStorageResourceName(data.item.storageResourceId) }}?
</delete-link>
</template>
@@ -68,6 +68,10 @@ export default {
},
defaultCredentialStoreToken: {
type: String
+ },
+ readonly: {
+ type: Boolean,
+ default: false
}
},
data() {
diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index 5ba819d..4e5fb21 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -805,6 +805,11 @@ class GatewayResourceProfileSerializer(
lookup_field='gatewayID',
lookup_url_kwarg='gateway_id')
storagePreferences = StoragePreferenceSerializer(many=True)
+ userHasWriteAccess = serializers.SerializerMethodField()
+
+ def get_userHasWriteAccess(self, gatewayResourceProfile):
+ request = self.context['request']
+ return request.is_gateway_admin
class StorageResourceSerializer(
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/GatewayResourceProfile.js b/django_airavata/apps/api/static/django_airavata_api/js/models/GatewayResourceProfile.js
index 5826e68..7ce6a72 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/GatewayResourceProfile.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/GatewayResourceProfile.js
@@ -11,7 +11,8 @@ const FIELDS = [
list: true
},
"identityServerTenant",
- "identityServerPwdCredToken"
+ "identityServerPwdCredToken",
+ "userHasWriteAccess"
];
export default class GatewayResourceProfile extends BaseModel {