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 master updated: AIRAVATA-3123 Create storage home dir on login
Date Sun, 14 Jul 2019 20:12:50 GMT
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 a9a7dc4  AIRAVATA-3123 Create storage home dir on login
a9a7dc4 is described below

commit a9a7dc4a1c3928b02aee6d51b48b58276d624b73
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Sun Jul 14 16:12:16 2019 -0400

    AIRAVATA-3123 Create storage home dir on login
---
 django_airavata/apps/api/apps.py    |  3 +++
 django_airavata/apps/api/signals.py | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/django_airavata/apps/api/apps.py b/django_airavata/apps/api/apps.py
index b0128ea..0937bc2 100644
--- a/django_airavata/apps/api/apps.py
+++ b/django_airavata/apps/api/apps.py
@@ -4,3 +4,6 @@ from django.apps import AppConfig
 class ApiConfig(AppConfig):
     name = 'django_airavata.apps.api'
     label = 'django_airavata_api'
+
+    def ready(self):
+        from . import signals # noqa
diff --git a/django_airavata/apps/api/signals.py b/django_airavata/apps/api/signals.py
new file mode 100644
index 0000000..3967e20
--- /dev/null
+++ b/django_airavata/apps/api/signals.py
@@ -0,0 +1,19 @@
+"""Signal receivers for the api app."""
+
+import logging
+
+from django.contrib.auth.signals import user_logged_in
+from django.dispatch import receiver
+
+from . import data_products_helper
+
+log = logging.getLogger(__name__)
+
+
+@receiver(user_logged_in)
+def create_user_storage_dir(sender, request, user, **kwargs):
+    """Create user's home direct in gateway storage."""
+    path = ""
+    if not data_products_helper.dir_exists(request, path):
+        data_products_helper.create_user_dir(request, path)
+        log.info("Created home directory for user {}".format(user.username))


Mime
View raw message