airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] branch develop updated: AIRAVATA-3383 Remove Sharing API service settings from config
Date Tue, 13 Jul 2021 14:25:58 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/develop by this push:
     new 87985ca  AIRAVATA-3383 Remove Sharing API service settings from config
87985ca is described below

commit 87985ca917a422a5525cd079a628c9bade0817ac
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Tue Jul 13 10:25:34 2021 -0400

    AIRAVATA-3383 Remove Sharing API service settings from config
---
 django_airavata/middleware.py            | 17 -----------------
 django_airavata/settings.py              |  1 -
 django_airavata/settings_local.py.ide    |  5 -----
 django_airavata/settings_local.py.sample |  4 ----
 django_airavata/utils.py                 | 27 ---------------------------
 tests/settings.py                        |  4 ----
 6 files changed, 58 deletions(-)

diff --git a/django_airavata/middleware.py b/django_airavata/middleware.py
index 8dfaaa8..8670839 100644
--- a/django_airavata/middleware.py
+++ b/django_airavata/middleware.py
@@ -35,23 +35,6 @@ class AiravataClientMiddleware:
             return None
 
 
-def sharing_client(get_response):
-    "Open and close Sharing registry client for each request"
-
-    def middleware(request):
-
-        # If user is logged in create a sharing registry client for the request
-        if request.user.is_authenticated:
-            request.sharing_client = utils.sharing_api_client_pool
-            response = get_response(request)
-        else:
-            response = get_response(request)
-
-        return response
-
-    return middleware
-
-
 def profile_service_client(get_response):
     """Open and close Profile Service client for each request.
 
diff --git a/django_airavata/settings.py b/django_airavata/settings.py
index f2931f6..0b0b955 100644
--- a/django_airavata/settings.py
+++ b/django_airavata/settings.py
@@ -123,7 +123,6 @@ MIDDLEWARE = [
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'django_airavata.apps.auth.middleware.authz_token_middleware',
     'django_airavata.middleware.AiravataClientMiddleware',
-    'django_airavata.middleware.sharing_client',
     'django_airavata.middleware.profile_service_client',
     # Needs to come after authz_token_middleware, airavata_client and
     # profile_service_client
diff --git a/django_airavata/settings_local.py.ide b/django_airavata/settings_local.py.ide
index 50c1b90..cb6af76 100644
--- a/django_airavata/settings_local.py.ide
+++ b/django_airavata/settings_local.py.ide
@@ -73,11 +73,6 @@ PROFILE_SERVICE_HOST = AIRAVATA_API_HOST
 PROFILE_SERVICE_PORT = 8962
 PROFILE_SERVICE_SECURE = False
 
-# Sharing API Configuration
-SHARING_API_HOST = AIRAVATA_API_HOST
-SHARING_API_PORT = 7878
-SHARING_API_SECURE = False
-
 # Portal settings
 PORTAL_TITLE = 'Django Airavata Gateway'
 
diff --git a/django_airavata/settings_local.py.sample b/django_airavata/settings_local.py.sample
index 67ab71c..6e3bff7 100644
--- a/django_airavata/settings_local.py.sample
+++ b/django_airavata/settings_local.py.sample
@@ -98,10 +98,6 @@ PROFILE_SERVICE_HOST = AIRAVATA_API_HOST
 PROFILE_SERVICE_PORT = 8962
 PROFILE_SERVICE_SECURE = False
 
-# Sharing API Configuration
-SHARING_API_HOST = AIRAVATA_API_HOST
-SHARING_API_PORT = 7878
-SHARING_API_SECURE = False
 
 # Portal settings
 PORTAL_TITLE = 'Django Airavata Gateway'
diff --git a/django_airavata/utils.py b/django_airavata/utils.py
index 006182e..2fe4d73 100644
--- a/django_airavata/utils.py
+++ b/django_airavata/utils.py
@@ -4,7 +4,6 @@ from contextlib import contextmanager
 
 import thrift_connector.connection_pool as connection_pool
 from airavata.api import Airavata
-from airavata.api.sharing import SharingRegistryService
 from airavata.service.profile.groupmanager.cpi import GroupManagerService
 from airavata.service.profile.groupmanager.cpi.constants import (
     GROUP_MANAGER_CPI_NAME
@@ -73,13 +72,6 @@ def create_airavata_client(transport):
     return client
 
 
-def create_sharing_client(transport):
-
-    protocol = TBinaryProtocol.TBinaryProtocol(transport)
-
-    return SharingRegistryService.Client(protocol)
-
-
 def get_binary_protocol(transport):
     return TBinaryProtocol.TBinaryProtocol(transport)
 
@@ -117,14 +109,6 @@ def get_airavata_client():
                              create_airavata_client)
 
 
-def get_sharing_client():
-    """Get Sharing API client as context manager (use in `with statement`)."""
-    return get_thrift_client(settings.SHARING_API_HOST,
-                             settings.SHARING_API_PORT,
-                             settings.SHARING_API_SECURE,
-                             create_sharing_client)
-
-
 def get_group_manager_client():
     """Group Manager client as context manager (use in `with statement`)."""
     return get_thrift_client(settings.PROFILE_SERVICE_HOST,
@@ -251,10 +235,6 @@ class UserProfileServiceThriftClient(MultiplexThriftClientMixin,
     secure = settings.PROFILE_SERVICE_SECURE
 
 
-class SharingAPIThriftClient(CustomThriftClient):
-    secure = settings.SHARING_API_SECURE
-
-
 airavata_api_client_pool = connection_pool.ClientPool(
     Airavata,
     settings.AIRAVATA_API_HOST,
@@ -290,10 +270,3 @@ user_profile_client_pool = connection_pool.ClientPool(
     connection_class=UserProfileServiceThriftClient,
     keepalive=settings.THRIFT_CLIENT_POOL_KEEPALIVE
 )
-sharing_api_client_pool = connection_pool.ClientPool(
-    SharingRegistryService,
-    settings.SHARING_API_HOST,
-    settings.SHARING_API_PORT,
-    connection_class=SharingAPIThriftClient,
-    keepalive=settings.THRIFT_CLIENT_POOL_KEEPALIVE
-)
diff --git a/tests/settings.py b/tests/settings.py
index 5352295..7bc12f0 100644
--- a/tests/settings.py
+++ b/tests/settings.py
@@ -23,8 +23,4 @@ PROFILE_SERVICE_HOST = AIRAVATA_API_HOST
 PROFILE_SERVICE_PORT = 8962
 PROFILE_SERVICE_SECURE = False
 
-SHARING_API_HOST = AIRAVATA_API_HOST
-SHARING_API_PORT = 7878
-SHARING_API_SECURE = False
-
 PORTAL_TITLE = 'Django Airavata Gateway'

Mime
View raw message