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/05/29 22:34:08 UTC

[airavata-django-portal] branch master updated (2cead47 -> bbf671d)

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 2cead47  AIRAVATA-3018 PaginationIterator using FetchUtils to display spinner
     new c9d3eb2  AIRAVATA-3040 WIP group membership editor
     add 8808990  AIRAVATA-3033 REST API for browsing, downloading user storage
     add d69d3d9  AIRAVATA-3016 Factor out data product handling from datastore
     add 028fd9e  AIRAVATA-3033 user storage API: make dirs, upload file
     add 5153409  AIRAVATA-3033 delete dir API
     add e69828c  AIRAVATA-3033 removing unused import
     add bb35ab0  AIRAVATA-3034 WIP: initial user storage browser
     add 56cf641  AIRAVATA-3034 Handle initial route, 404s
     add 2620f18  AIRAVATA-3034 user storage breadcrumbs
     add 643a55f  AIRAVATA-3034 sorting by name and created time
     add 33f1258  AIRAVATA-3034 File, directory size, with sorting
     add 615713a  AIRAVATA-3034 Fixing double initial load of data
     add bbd90ce  AIRAVATA-3034 UI enhancements to storage browser
     add 68d736e  AIRAVATA-3016 Removing sanitizing usernames
     add 52968ff  AIRAVATA-3034 changed icons, order of storage columns
     add d04ded4  AIRAVATA-3034 Upload files, add new directory
     add 87f4d83  AIRAVATA-3034 Delete directories, path
     add 274d32d  AIRAVATA-3016 Removing unused import
     add 4ace7f4  AIRAVATA-3016 Adding data_products_helper.user_file_exists
     add f56ca58  AIRAVATA-3032 Upload input files to tmp directory
     add eeb471b  AIRAVATA-3032 Move tmp input file uploads to data dir at launch
     add a63fd11  AIRAVATA-3032 Copy cloned input files to tmp input file dir
     add 8657f9d  AIRAVATA-3032 Add isInputFileUpload to DataProductSerializer
     add eddcb00  AIRAVATA-3032 Hide tmp input file upload dir in viewer
     add 2813ea5  AIRAVATA-3034 Fixing lint errors
     new 834b78d  AIRAVATA-3034 Ignore broken symlinks when calculating dir size
     new 87e0ba3  AIRAVATA-3016 Remove unneeded code
     new bbf671d  Merge branch 'airavata-3016'

The 4 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:
 .../components/users/UserGroupMembershipEditor.vue |  57 +++++
 .../components/users/UserManagementContainer.vue   |  32 ++-
 django_airavata/apps/api/data_products_helper.py   | 225 ++++++++++++++++++
 django_airavata/apps/api/datastore.py              | 251 +++++++++------------
 django_airavata/apps/api/exceptions.py             |   7 +
 .../apps/api/migrations/0002_auto_20190513_2037.py |  27 +++
 django_airavata/apps/api/models.py                 |  12 +
 django_airavata/apps/api/serializers.py            |  50 +++-
 .../api/static/django_airavata_api/js/index.js     |  10 +-
 .../django_airavata_api/js/models/DataProduct.js   |   1 +
 .../js/models/ManagedUserProfile.js                |   1 +
 .../js/models/UserStorageDirectory.js              |  15 ++
 .../js/models/UserStorageFile.js                   |  15 ++
 .../js/models/UserStoragePath.js                   |  27 +++
 .../django_airavata_api/js/service_config.js       |  12 +
 .../js/services/ServiceFactory.js                  |  52 +++--
 .../django_airavata_api/js/session/Session.js      |   7 +
 django_airavata/apps/api/urls.py                   |   7 +-
 django_airavata/apps/api/views.py                  | 240 +++++++++++---------
 .../workspace/migrations/0002_delete_user_files.py |  18 ++
 django_airavata/apps/workspace/models.py           |   8 -
 django_airavata/apps/workspace/package.json        |   7 +-
 .../experiment/input-editors/FileInputEditor.vue   |  29 ++-
 .../js/components/project/AddFileButton.vue        | 136 -----------
 .../storage/UserStoragePathBreadcrumb.vue          |  39 ++++
 .../components/storage/UserStoragePathViewer.vue   | 139 ++++++++++++
 .../js/containers/ProjectListContainer.vue         |   3 -
 .../js/containers/UserStorageContainer.vue         | 162 +++++++++++++
 .../js/entry-user-storage.js                       |  26 +++
 .../templates/django_airavata_workspace/base.html  |   5 +-
 django_airavata/apps/workspace/urls.py             |   1 +
 django_airavata/apps/workspace/views.py            |  19 +-
 django_airavata/apps/workspace/vue.config.js       |   1 +
 .../common/js/components/NotificationsDisplay.vue  |   2 +
 django_airavata/static/common/js/entry.js          |   4 +
 django_airavata/static/common/package.json         |   2 +-
 django_airavata/templates/base.html                |   6 +
 37 files changed, 1217 insertions(+), 438 deletions(-)
 create mode 100644 django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserGroupMembershipEditor.vue
 create mode 100644 django_airavata/apps/api/data_products_helper.py
 create mode 100644 django_airavata/apps/api/migrations/0002_auto_20190513_2037.py
 create mode 100644 django_airavata/apps/api/static/django_airavata_api/js/models/UserStorageDirectory.js
 create mode 100644 django_airavata/apps/api/static/django_airavata_api/js/models/UserStorageFile.js
 create mode 100644 django_airavata/apps/api/static/django_airavata_api/js/models/UserStoragePath.js
 create mode 100644 django_airavata/apps/api/static/django_airavata_api/js/session/Session.js
 create mode 100644 django_airavata/apps/workspace/migrations/0002_delete_user_files.py
 delete mode 100644 django_airavata/apps/workspace/static/django_airavata_workspace/js/components/project/AddFileButton.vue
 create mode 100644 django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathBreadcrumb.vue
 create mode 100644 django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathViewer.vue
 create mode 100644 django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/UserStorageContainer.vue
 create mode 100644 django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-user-storage.js


[airavata-django-portal] 04/04: Merge branch 'airavata-3016'

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 bbf671da3c04b0766aa74875cd396d0ed0a73864
Merge: c9d3eb2 87e0ba3
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed May 29 18:33:45 2019 -0400

    Merge branch 'airavata-3016'

 django_airavata/apps/api/data_products_helper.py   | 225 ++++++++++++++++++
 django_airavata/apps/api/datastore.py              | 251 +++++++++------------
 django_airavata/apps/api/exceptions.py             |   7 +
 .../apps/api/migrations/0002_auto_20190513_2037.py |  27 +++
 django_airavata/apps/api/models.py                 |  12 +
 django_airavata/apps/api/serializers.py            |  49 +++-
 .../api/static/django_airavata_api/js/index.js     |  10 +-
 .../django_airavata_api/js/models/DataProduct.js   |   1 +
 .../js/models/UserStorageDirectory.js              |  15 ++
 .../js/models/UserStorageFile.js                   |  15 ++
 .../js/models/UserStoragePath.js                   |  27 +++
 .../django_airavata_api/js/service_config.js       |  12 +
 .../js/services/ServiceFactory.js                  |  52 +++--
 .../django_airavata_api/js/session/Session.js      |   7 +
 django_airavata/apps/api/urls.py                   |   7 +-
 django_airavata/apps/api/views.py                  | 229 ++++++++++---------
 .../workspace/migrations/0002_delete_user_files.py |  18 ++
 django_airavata/apps/workspace/models.py           |   8 -
 django_airavata/apps/workspace/package.json        |   7 +-
 .../experiment/input-editors/FileInputEditor.vue   |  29 ++-
 .../js/components/project/AddFileButton.vue        | 136 -----------
 .../storage/UserStoragePathBreadcrumb.vue          |  39 ++++
 .../components/storage/UserStoragePathViewer.vue   | 139 ++++++++++++
 .../js/containers/ProjectListContainer.vue         |   3 -
 .../js/containers/UserStorageContainer.vue         | 162 +++++++++++++
 .../js/entry-user-storage.js                       |  26 +++
 .../templates/django_airavata_workspace/base.html  |   5 +-
 django_airavata/apps/workspace/urls.py             |   1 +
 django_airavata/apps/workspace/views.py            |  19 +-
 django_airavata/apps/workspace/vue.config.js       |   1 +
 .../common/js/components/NotificationsDisplay.vue  |   2 +
 django_airavata/static/common/js/entry.js          |   4 +
 django_airavata/static/common/package.json         |   2 +-
 django_airavata/templates/base.html                |   6 +
 34 files changed, 1118 insertions(+), 435 deletions(-)

diff --cc django_airavata/apps/api/views.py
index e92135f,305552e..c42d304
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@@ -38,10 -37,16 +38,17 @@@ from django_airavata.apps.api.view_util
      APIResultPagination,
      GenericAPIBackedViewSet
  )
 +from django_airavata.apps.auth import iam_admin_client
- from django_airavata.apps.workspace.models import User_Files
  
- from . import datastore, helpers, models, serializers, thrift_utils
+ from . import (
+     data_products_helper,
+     datastore,
+     helpers,
+     models,
+     serializers,
+     thrift_utils
+ )
+ 
  
  READ_PERMISSION_TYPE = '{}:READ'
  


[airavata-django-portal] 03/04: AIRAVATA-3016 Remove unneeded code

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 87e0ba3fd0bbfe577355cd1029e80aeea4f167b6
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed May 29 18:32:32 2019 -0400

    AIRAVATA-3016 Remove unneeded code
---
 django_airavata/apps/api/urls.py                   |   4 -
 django_airavata/apps/api/views.py                  |  79 +-----------
 .../js/components/project/AddFileButton.vue        | 136 ---------------------
 .../js/containers/ProjectListContainer.vue         |   3 -
 4 files changed, 4 insertions(+), 218 deletions(-)

diff --git a/django_airavata/apps/api/urls.py b/django_airavata/apps/api/urls.py
index 6b80b19..798492e 100644
--- a/django_airavata/apps/api/urls.py
+++ b/django_airavata/apps/api/urls.py
@@ -45,10 +45,6 @@ router.register(r'parsers', views.ParserViewSet, base_name='parser')
 app_name = 'django_airavata_api'
 urlpatterns = [
     url(r'^', include(router.urls)),
-    # TODO: remove these
-    # url(r'^get-ufiles$', views.get_user_files, name='get_user_files'),
-    # url(r'^upload-ufiles$', views.upload_user_file, name='upload_user_file'),
-    # url(r'^delete-ufiles$', views.delete_user_file, name='delete_user_file'),
     url(r'^upload$', views.upload_input_file, name='upload_input_file'),
     url(r'^download', views.download_file, name='download_file'),
     url(r'^delete-file$', views.delete_file, name='delete_file'),
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index c3e652c..305552e 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -47,8 +47,6 @@ from . import (
     thrift_utils
 )
 
-# from django_airavata.apps.workspace.models import User_Files
-
 
 READ_PERMISSION_TYPE = '{}:READ'
 
@@ -829,64 +827,6 @@ class DataProductView(APIView):
             data_product, context={'request': request})
         return Response(serializer.data)
 
-# TODO: remove
-# @login_required
-# def get_user_files(request):
-
-#         dirs = []      # a list with file_name and file_dpu for each file
-#         for o in User_Files.objects.values_list('file_name', 'file_dpu'):
-#             file_details = {}
-#             file_details['file_name'] = o[0]
-#             file_details['file_dpu'] = o[1]
-#             dirs.append(file_details)
-
-#         return JsonResponse({'uploaded': True, 'user-files': dirs})
-
-
-# @login_required
-# def upload_user_file(request):
-#         username = request.user.username
-#         input_file = request.FILES['file']
-#         file_details = {}
-
-#         # To avoid duplicate file names
-
-#         if User_Files.objects.filter(file_name=input_file.name).exists():
-#             resp = JsonResponse({'uploaded': False, 'error': "File already exists"})
-#             resp.status_code = 400
-#             return resp
-
-#         else:
-
-#             data_product = datastore.save_user(username, input_file)
-#             data_product_uri = request.airavata_client.registerDataProduct(
-#                 request.authz_token, data_product)
-#             d = User_Files(file_name=input_file.name, file_dpu=data_product_uri)
-#             d.save()
-#             file_details['file_name'] = d.file_name
-#             file_details['file_dpu'] = d.file_dpu
-#             return JsonResponse({'uploaded': True,
-#                                  'upload-file': file_details})
-
-
-# @login_required
-# def delete_user_file(request):
-#         data_product_uri = request.body.decode('utf-8')
-#         try:
-#             data_product = request.airavata_client.getDataProduct(
-#                 request.authz_token, data_product_uri)
-
-#         except Exception as e:
-#             log.warning("Failed to load DataProduct for {}"
-#                         .format(data_product_uri), exc_info=True)
-#             raise Http404("data product does not exist")(e)
-
-#         # remove file_details entry from database and delete from datastore
-#         User_Files.objects.filter(file_dpu=data_product_uri).delete()
-#         datastore.delete(data_product)
-
-#         return JsonResponse({'deleted': True})
-
 
 @login_required
 def upload_input_file(request):
@@ -1390,32 +1330,21 @@ class UserStoragePathView(APIView):
     serializer_class = serializers.UserStoragePathSerializer
 
     def get(self, request, path="/", format=None):
-        # TODO: don't need to relativize path any longer?
-        user_storage_path = path
-        if user_storage_path.startswith("/"):
-            user_storage_path = "." + user_storage_path
-        # TODO: check if path is directory or file
         return self._create_response(request, path)
 
     def post(self, request, path="/", format=None):
-        user_storage_path = path
-        if user_storage_path.startswith("/"):
-            user_storage_path = "." + user_storage_path
-        if not data_products_helper.dir_exists(request, user_storage_path):
-            data_products_helper.create_user_dir(request, user_storage_path)
+        if not data_products_helper.dir_exists(request, path):
+            data_products_helper.create_user_dir(request, path)
 
         data_product = None
         if 'file' in request.FILES:
             user_file = request.FILES['file']
             data_product = data_products_helper.save(
-                request, user_storage_path, user_file)
+                request, path, user_file)
         return self._create_response(request, path, uploaded=data_product)
 
     def delete(self, request, path="/", format=None):
-        user_storage_path = path
-        if user_storage_path.startswith("/"):
-            user_storage_path = "." + user_storage_path
-        data_products_helper.delete_dir(request, user_storage_path)
+        data_products_helper.delete_dir(request, path)
         return Response(status=204)
 
     def _create_response(self, request, path, uploaded=None):
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/project/AddFileButton.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/project/AddFileButton.vue
deleted file mode 100644
index 2bab8d7..0000000
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/project/AddFileButton.vue
+++ /dev/null
@@ -1,136 +0,0 @@
-<template>
-  <div>
-    <b-btn v-b-modal="'modal-add-file'" variant="primary" @click="getUserFiles">
-      <slot>
-        Add Files <i class="fa fa-plus" aria-hidden="true"></i>
-      </slot>
-    </b-btn>
-
-    <b-modal id="modal-add-file" scrollable hide-footer title="User Files" ref="modalAddFile">
-
-      <b-form-checkbox
-            v-model="selected"
-            v-for="userfile in userfiles"
-            :key="userfile.file_dpu"
-            :value="userfile.file_dpu">
-
-        <label class="file-option">{{ userfile.file_name}}</label>
-
-       </b-form-checkbox>
-
-      <footer id="modal-add-file___BV_modal_footer_" class="modal-footer">
-
-        <div class="upload-btn-wrapper">
-
-          <b-btn class="upload_btn" variant="success">Upload</b-btn>
-
-          <input type="file" id="file" class="inputfile" ref="file" multiple  v-on:change="handleFileUpload()"/>
-
-        </div>
-
-        <b-btn variant="danger" @click="handleFileDelete">Delete</b-btn>
-        <b-btn variant="primary" @click="closeModal">Close</b-btn>
-
-      </footer>
-
-    </b-modal>
-  </div>
-</template>
-
-<script>
-
-import { utils as apiUtils } from "django-airavata-api";
-
-  export default {
-    name: 'add-file-button',
-    data () {
-      return {
-        userfiles:[],
-        selected: [],
-        files:'',
-        value:''
-
-      }
-    },
-    components: {
-    },
-    methods: {
-      handleFileUpload(){
-
-        //multiple file upload
-
-        for (const entry of this.$refs.file.files) {
-
-          let formData=new FormData();
-          formData.append('file',entry);
-          apiUtils.FetchUtils.post(
-            "/api/upload-ufiles",
-            formData
-          ).then(res => (this.userfiles.push(res['file_details'])));
-
-        }
-
-        window.location.reload()
-
-      },
-
-      handleFileDelete: function () {
-
-
-        //post to delete multiple user files
-
-        for (const entry of this.selected) {
-
-         apiUtils.FetchUtils.post(
-           "/api/delete-ufiles",
-           entry
-         ).then(res => (this.value = res['deleted']));
-
-        }
-
-        window.location.reload()
-
-      },
-      getUserFiles(){
-        return apiUtils.FetchUtils.get(
-          "/api/get-ufiles"
-        ).then(res => (this.userfiles =res['user-files']));
-
-      },
-      closeModal(){
-        this.$refs['modalAddFile'].hide()
-      }
-
-    },
-    computed: {
-
-    },
-
-  }
-
-</script>
-
-<style scoped>
-
-  .upload-btn-wrapper {
-    position: relative;
-    overflow: hidden;
-    display: inline-block;
-  }
-
-  .upload-btn-wrapper input[type=file] {
-    font-size: 100px;
-    position: absolute;
-    left: 0;
-    top: 0;
-    opacity: 0;
-  }
-
-  .modal-body {
-    float: left;
-    flex-flow: column;
-    flex-direction: column;
-  }
-
-
-</style>
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/ProjectListContainer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/ProjectListContainer.vue
index 4567015..5ffd528 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/ProjectListContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/ProjectListContainer.vue
@@ -6,7 +6,6 @@
             </div>
             <div id="col-new-project" class="col">
                 <project-button-new @new-project="onNewProject"/>
-                <add-file-button class="mt-1"></add-file-button>
             </div>
         </div>
         <div class="row">
@@ -29,7 +28,6 @@ import ProjectList from '../components/project/ProjectList.vue'
 
 import { services } from 'django-airavata-api'
 import { components as comps } from 'django-airavata-common-ui'
-import AddFileButton from "../components/project/AddFileButton";
 
 export default {
     props: ['initialProjectsData'],
@@ -42,7 +40,6 @@ export default {
     components: {
         'project-list': ProjectList,
         'project-button-new': ProjectButtonNew,
-        'add-file-button':AddFileButton,
         'pager': comps.Pager,
 
     },


[airavata-django-portal] 01/04: AIRAVATA-3040 WIP group membership editor

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 c9d3eb291246ccf7fbd69648c47111f3ce5423f1
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed May 29 18:20:22 2019 -0400

    AIRAVATA-3040 WIP group membership editor
---
 .../components/users/UserGroupMembershipEditor.vue | 57 ++++++++++++++++++++++
 .../components/users/UserManagementContainer.vue   | 32 +++++++++++-
 django_airavata/apps/api/serializers.py            |  1 +
 .../js/models/ManagedUserProfile.js                |  1 +
 django_airavata/apps/api/views.py                  | 11 ++++-
 5 files changed, 99 insertions(+), 3 deletions(-)

diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserGroupMembershipEditor.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserGroupMembershipEditor.vue
new file mode 100644
index 0000000..494f862
--- /dev/null
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserGroupMembershipEditor.vue
@@ -0,0 +1,57 @@
+<template>
+  <b-form-group label="Groups">
+    <b-form-checkbox-group
+      :checked="selected"
+      :options="options"
+      stacked
+    ></b-form-checkbox-group>
+  </b-form-group>
+</template>
+
+<script>
+export default {
+  name: "user-group-membership-editor",
+  props: {
+    groups: {
+      type: Array,
+      required: true
+    },
+    editableGroups: {
+      type: Array,
+      required: true
+    }
+  },
+  data() {
+    return {
+    }
+  },
+  computed: {
+    selected() {
+      return this.groups.map(g => g.id);
+    },
+    options() {
+      const options = this.groups.map(g => {
+        return {
+          text: g.name,
+          value: g.id,
+          disabled: true
+        }
+      });
+      this.editableGroups.forEach(g => {
+        const editableOption = options.find(opt => opt.value === g.id);
+        if (editableOption) {
+          editableOption.disabled = false;
+        } else {
+          options.push({
+            text: g.name,
+            value: g.id,
+            disabled: false
+          })
+        }
+      })
+      return options;
+    }
+  }
+};
+</script>
+
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserManagementContainer.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserManagementContainer.vue
index 4a5d7c0..dbbcb13 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserManagementContainer.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/users/UserManagementContainer.vue
@@ -14,6 +14,23 @@
               :fields="fields"
               :items="items"
             >
+              <template
+                slot="action"
+                slot-scope="data"
+              >
+                <b-button
+                  v-if="data.item.airavataUserProfileExists"
+                  @click="data.toggleDetails"
+                >
+                  Edit Groups
+                </b-button>
+              </template>
+              <template
+                slot="row-details"
+                slot-scope="data"
+              >
+                <user-group-membership-editor :groups="data.item.groups" :editableGroups="editableGroups" />
+              </template>
             </b-table>
             <pager
               v-bind:paginator="usersPaginator"
@@ -30,21 +47,27 @@
 <script>
 import { services } from "django-airavata-api";
 import { components } from "django-airavata-common-ui";
+import UserGroupMembershipEditor from "./UserGroupMembershipEditor.vue";
 
 export default {
   name: "user-management-container",
   data() {
     return {
-      usersPaginator: null
+      usersPaginator: null,
+      allGroups: null
     };
   },
   components: {
-    pager: components.Pager
+    pager: components.Pager,
+    UserGroupMembershipEditor
   },
   created() {
     services.ManagedUserProfileService.list({ limit: 10 }).then(
       users => (this.usersPaginator = users)
     );
+    services.GroupService.list({ limit: -1 }).then(
+      groups => (this.allGroups = groups)
+    );
   },
   computed: {
     fields() {
@@ -81,6 +104,11 @@ export default {
     },
     items() {
       return this.usersPaginator ? this.usersPaginator.results : [];
+    },
+    editableGroups() {
+      return this.allGroups
+        ? this.allGroups.filter(g => g.isAdmin || g.isOwner)
+        : [];
     }
   },
   methods: {
diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index 26ebf7e..7e27870 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -771,6 +771,7 @@ class ManagedUserProfile(serializers.Serializer):
     lastName = serializers.CharField()
     enabled = serializers.BooleanField()
     emailVerified = serializers.BooleanField()
+    airavataUserProfileExists = serializers.BooleanField()
     groups = GroupSerializer(many=True)
     url = FullyEncodedHyperlinkedIdentityField(
         view_name='django_airavata_api:managed-user-profile-detail',
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/ManagedUserProfile.js b/django_airavata/apps/api/static/django_airavata_api/js/models/ManagedUserProfile.js
index d29065a..0a7b4f0 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/ManagedUserProfile.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/ManagedUserProfile.js
@@ -11,6 +11,7 @@ const FIELDS = [
   "lastName",
   "enabled",
   "emailVerified",
+  "airavataUserProfileExists",
   {
     name: "groups",
     type: Group,
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index bf25e84..e92135f 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -1390,6 +1390,14 @@ class ManagedUserViewSet(mixins.CreateModelMixin,
             iam_admin_client.get_user(lookup_value))
 
     def _convert_user_profile(self, user_profile):
+        user_profile_client = self.request.profile_service['user_profile']
+        group_manager_client = self.request.profile_service['group_manager']
+        airavata_user_profile_exists = user_profile_client.doesUserExist(
+            self.authz_token, user_profile.userId, self.gateway_id)
+        groups = []
+        if airavata_user_profile_exists:
+            groups = group_manager_client.getAllGroupsUserBelongs(
+                self.authz_token, user_profile.airavataInternalUserId)
         return {
             'airavataInternalUserId': user_profile.airavataInternalUserId,
             'userId': user_profile.userId,
@@ -1400,5 +1408,6 @@ class ManagedUserViewSet(mixins.CreateModelMixin,
             # TODO: fix this to distinguish between enabled and emailVerified
             'enabled': user_profile.State == Status.CONFIRMED,
             'emailVerified': user_profile.State == Status.CONFIRMED,
-            'groups': []
+            'airavataUserProfileExists': airavata_user_profile_exists,
+            'groups': groups
         }


[airavata-django-portal] 02/04: AIRAVATA-3034 Ignore broken symlinks when calculating dir size

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 834b78daab86780ceea5d8a54928a0f6572c0ae5
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed May 29 18:30:50 2019 -0400

    AIRAVATA-3034 Ignore broken symlinks when calculating dir size
---
 django_airavata/apps/api/datastore.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/django_airavata/apps/api/datastore.py b/django_airavata/apps/api/datastore.py
index 6369d22..2707db0 100644
--- a/django_airavata/apps/api/datastore.py
+++ b/django_airavata/apps/api/datastore.py
@@ -171,5 +171,8 @@ def _get_dir_size(start_path='.'):
     for dirpath, dirnames, filenames in os.walk(start_path):
         for f in filenames:
             fp = os.path.join(dirpath, f)
-            total_size += os.path.getsize(fp)
+            # Check for broken symlinks (.exists return False for broken
+            # symlinks)
+            if os.path.exists(fp):
+                total_size += os.path.getsize(fp)
     return total_size