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/11/25 18:43:39 UTC
[airavata-django-portal] 01/02: AIRAVATA-3279 Check if user has
READ access to project
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 85d0da0b16f62f5b76ec37deae1d56425a91b524
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Nov 25 13:41:42 2019 -0500
AIRAVATA-3279 Check if user has READ access to project
---
django_airavata/apps/api/views.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index 23b4975..14ff2c3 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -15,7 +15,6 @@ from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from rest_framework.views import APIView
-from airavata.api.error.ttypes import ProjectNotFoundException
from airavata.model.appcatalog.computeresource.ttypes import (
CloudJobSubmission,
GlobusJobSubmission,
@@ -505,10 +504,13 @@ class FullExperimentViewSet(mixins.RetrieveModelMixin,
log.exception("Failed to load compute resource for {}".format(
compute_resource_id))
compute_resource = None
- try:
+ if self.request.airavata_client.userHasAccess(
+ self.authz_token,
+ experimentModel.projectId,
+ ResourcePermissionType.READ):
project = self.request.airavata_client.getProject(
self.authz_token, experimentModel.projectId)
- except ProjectNotFoundException as pnfe:
+ else:
# User may not have access to project, only experiment
project = None
job_details = self.request.airavata_client.getJobDetails(