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 2018/09/24 19:24:15 UTC

[airavata-django-portal] 03/03: AIRAVATA-2840 WIP: display list of SSH credentials

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 77ab5c229722a2f986c0b0252721aead411d2032
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Mon Sep 24 15:23:56 2018 -0400

    AIRAVATA-2840 WIP: display list of SSH credentials
---
 .../dashboards/CredentialStoreDashboard.vue        | 187 +++++----------
 .../static/django_airavata_admin/src/router.js     |   2 +-
 django_airavata/apps/admin/urls.py                 |   5 +-
 django_airavata/apps/admin/views.py                |   2 +-
 django_airavata/apps/api/serializers.py            |   7 +
 .../js/models/CredentialSummary.js                 |  38 +--
 .../django_airavata_api/js/service_config.js       | 263 +++++++++++++--------
 django_airavata/apps/api/urls.py                   |  63 ++---
 django_airavata/apps/api/views.py                  | 215 +++++------------
 9 files changed, 343 insertions(+), 439 deletions(-)

diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/CredentialStoreDashboard.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/CredentialStoreDashboard.vue
index a622631..04ba927 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/CredentialStoreDashboard.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/dashboards/CredentialStoreDashboard.vue
@@ -1,132 +1,71 @@
 <template>
-  <div class="gen">
-    <loading></loading>
-    <div class="main_section interface-main" v-on:created="fetchSSHKeys()">
-      <div class="input-field-header">
-        Generate New SSH Key
-      </div>
-      <generate-s-s-h-key v-on:created="fetchSSHKeys()"></generate-s-s-h-key>
-    </div>
-    <div class="main_section interface-main">
-      <div class="input-field-header">
-        SSH Keys
-      </div>
-      <div>
-        <div class="ssh" v-bind:id="'id_'+sshKey.token" v-for="sshKey in sshKeys">
-          <h6>Description:</h6>
-          <label v-if="sshKey.description">{{sshKey.description}}</label>
-          <label style="color:#007BFF" v-else>Description for the SHH Key is not available</label>
-          <div class="ssh-key">
-            <div class="ssh-val">
-              <input readonly type="text" v-bind:id="sshKey.token" v-model="sshKey.publicKey"/>
-              <button class="vbtn vbtn-default" v-on:click="copySSHKey(sshKey.token)">Copy</button>
-            </div>
-            <button class="vbtn vbtn-cancel" v-on:click="deleteSSHKey(sshKey)">Delete</button>
-          </div>
-        </div>
-      </div>
-    </div>
-  </div>
+  <list-layout @add-new-item="addNewSSHCredential" :items="sshKeys" title="SSH Credentials" new-item-button-text="New SSH Credential">
+    <template slot="item-list" slot-scope="slotProps">
+
+      <b-table striped hover :fields="fields" :items="slotProps.items">
+        <template slot="action" slot-scope="data">
+          <delete-link @delete="deleteSSHCredential(data.item)">
+            Are you sure you want to delete this SSH credential?
+          </delete-link>
+        </template>
+      </b-table>
+    </template>
+  </list-layout>
 </template>
+
 <script>
-  import GenerateSSHKey from '../admin/GenerateSSHKey.vue'
-  import Loading from '../Loading.vue'
-  import Utils from '../../utils'
+import { services } from "django-airavata-api";
+import { components, layouts } from "django-airavata-common-ui";
+import moment from "moment";
 
-  export default {
-    components: {
-      GenerateSSHKey, Loading
-    },
-    mounted: function () {
-      this.fetchSSHKeys()
-    },
-    data: function () {
-      return {
-        sshKeys: []
-      }
-    },
-    methods: {
-      fetchSSHKeys: function () {
-        Utils.get('/api/credentials/ssh/keys', {success: (value) => this.sshKeys = value})
-      },
-      deleteSSHKey: function (sshKey) {
-        var success = (value) => {
-          console.log("Successfully Deleted key:", value)
-          var el=document.getElementById('id_'+sshKey.token)
-          el.classList.add("remove")
-          this.sshKeys.splice(this.sshKeys.indexOf(sshKey), 1)
-          this.sshKeys = [].concat(this.sshKeys)
+export default {
+  components: {
+    "delete-link": components.DeleteLink,
+    "list-layout": layouts.ListLayout
+  },
+  created: function() {
+    this.fetchSSHKeys();
+  },
+  data: function() {
+    return {
+      sshKeys: []
+    };
+  },
+  computed: {
+    fields() {
+      return [
+        {
+          label: "Description",
+          key: "description"
+        },
+        {
+          label: "User",
+          key: "username"
+        },
+        {
+          label: "Created",
+          key: "persistedTime",
+          formatter: value => moment(new Date(value)).fromNow()
+        },
+        {
+          label: "Action",
+          key: "action"
         }
-        Utils.post('/api/credentials/ssh/key/delete', {'token': sshKey.token}, {success: success})
-      },
-      copySSHKey: function (token) {
-        var sshKeyElement = document.getElementById(token)
-        sshKeyElement.select()
-        document.execCommand('copy')
-        sshKeyElement.blur()
-      }
-
+      ];
     }
+  },
+  methods: {
+    fetchSSHKeys() {
+      services.CredentialSummaryService.allSSHCredentials().then(sshCreds => {
+        console.log(
+          "loaded SSH Credentials",
+          JSON.stringify(sshCreds, null, 4)
+        );
+        this.sshKeys = sshCreds;
+      });
+    },
+    addNewSSHCredentials() {},
+    deleteSSHCredential() {}
   }
+};
 </script>
-<style>
-  .gen {
-    padding: 10px;
-    width: 40%;
-    height: 100%;
-  }
-
-  @keyframes fadeIn {
-    from{opacity: 0}
-    to{opacity: 1}
-  }
-
-  @keyframes fadeOut {
-    from{opacity: 1}
-    to{opacity: 0}
-  }
-
-  .ssh {
-    padding: 10px;
-    border-bottom: solid 1px #dddddd;
-    animation: fadeIn 1s;
-  }
-  .ssh.remove{
-    animation: fadeOut 1s;
-    opacity: 1;
-  }
-
-
-  .ssh-key {
-    display: inline-flex;
-    width: 100%;
-  }
-
-  .ssh-val {
-    display: inline-flex;
-    width: 100%;
-  }
-
-  .ssh-val button {
-    margin-left: 0px;
-    border-top-left-radius: 0px;
-    border-bottom-left-radius: 0px;
-  }
-
-  .ssh-val input {
-    border-top-right-radius: 0px;
-    border-bottom-right-radius: 0px;
-  }
-
-  .ssh .vbtn.vbtn-cancel:hover {
-    border-color: #ff0b03;
-    background-color: #ff0b03;
-    color: white;
-  }
-
-  .ssh .vbtn.vbtn-cancel:active {
-    border-color: #ff0b03;
-    background-color: white;
-    color: #ff0b03;
-  }
-</style>
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/router.js b/django_airavata/apps/admin/static/django_airavata_admin/src/router.js
index 87f1f52..71eef6f 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/router.js
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/router.js
@@ -113,7 +113,7 @@ const routes = [
     name: "group_resource_preference_dashboard"
   },
   {
-    path: "/credential/store",
+    path: "/credentials",
     component: CredentialStoreDashboard,
     name: "credential_store"
   }
diff --git a/django_airavata/apps/admin/urls.py b/django_airavata/apps/admin/urls.py
index c763365..92e06e6 100644
--- a/django_airavata/apps/admin/urls.py
+++ b/django_airavata/apps/admin/urls.py
@@ -6,6 +6,7 @@ app_name = 'django_airavata_admin'
 urlpatterns = [
     url(r'^$', views.home, name='home'),
     url(r'^applications/', views.app_catalog, name='app_catalog'),
-    url(r'^credential_store$', views.credential_store, name='credential_store'),
-    url(r'^group-resource-profiles/', views.group_resource_profile, name='group_resource_profile'),
+    url(r'^credentials/', views.credential_store, name='credential_store'),
+    url(r'^group-resource-profiles/', views.group_resource_profile,
+        name='group_resource_profile'),
 ]
diff --git a/django_airavata/apps/admin/views.py b/django_airavata/apps/admin/views.py
index d8c710c..8f1df4b 100644
--- a/django_airavata/apps/admin/views.py
+++ b/django_airavata/apps/admin/views.py
@@ -17,7 +17,7 @@ def app_catalog(request):
 @login_required
 def credential_store(request):
     request.active_nav_item = 'credential_store'
-    return render(request, 'admin/credential_store.html')
+    return render(request, 'admin/admin_base.html')
 
 
 @login_required
diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index c052a40..58652dc 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -630,3 +630,10 @@ class CredentialSummarySerializer(
         thrift_utils.create_serializer_class(CredentialSummary)):
     type = thrift_utils.ThriftEnumField(SummaryType)
     persistedTime = UTCPosixTimestampDateTimeField()
+    userHasWriteAccess = serializers.SerializerMethodField()
+
+    def get_userHasWriteAccess(self, credential_summary):
+        request = self.context['request']
+        return request.airavata_client.userHasAccess(
+            request.authz_token, credential_summary.token,
+            ResourcePermissionType.WRITE)
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/CredentialSummary.js b/django_airavata/apps/api/static/django_airavata_api/js/models/CredentialSummary.js
index a85d89e..9a658ec 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/CredentialSummary.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/CredentialSummary.js
@@ -1,25 +1,25 @@
-import BaseModel from './BaseModel'
-import SummaryType from './SummaryType'
+import BaseModel from "./BaseModel";
+import SummaryType from "./SummaryType";
 
 const FIELDS = [
-    {
-        name: 'type',
-        type: SummaryType,
-    },
-    'gatewayId',
-    'username',
-    'publicKey',
-    {
-        name: 'persistedTime',
-        type: Date,
-    },
-    'token',
-    'description',
+  {
+    name: "type",
+    type: SummaryType
+  },
+  "gatewayId",
+  "username",
+  "publicKey",
+  {
+    name: "persistedTime",
+    type: Date
+  },
+  "token",
+  "description",
+  "userHasWriteAccess"
 ];
 
 export default class CredentialSummary extends BaseModel {
-
-    constructor(data = {}) {
-        super(FIELDS, data);
-    }
+  constructor(data = {}) {
+    super(FIELDS, data);
+  }
 }
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/service_config.js b/django_airavata/apps/api/static/django_airavata_api/js/service_config.js
index 6467fe7..1a707fd 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/service_config.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/service_config.js
@@ -1,13 +1,13 @@
-import ApplicationDeploymentDescription from './models/ApplicationDeploymentDescription'
-import ApplicationModule from './models/ApplicationModule';
-import ComputeResourceDescription from './models/ComputeResourceDescription'
-import CredentialSummary from './models/CredentialSummary'
-import Group from './models/Group'
-import GroupResourceProfile from './models/GroupResourceProfile'
-import SharedEntity from './models/SharedEntity'
-import UserProfile from './models/UserProfile'
-import ApplicationInterfaceDefinition from './models/ApplicationInterfaceDefinition';
-import BatchQueue from './models/BatchQueue';
+import ApplicationDeploymentDescription from "./models/ApplicationDeploymentDescription";
+import ApplicationModule from "./models/ApplicationModule";
+import ComputeResourceDescription from "./models/ComputeResourceDescription";
+import CredentialSummary from "./models/CredentialSummary";
+import Group from "./models/Group";
+import GroupResourceProfile from "./models/GroupResourceProfile";
+import SharedEntity from "./models/SharedEntity";
+import UserProfile from "./models/UserProfile";
+import ApplicationInterfaceDefinition from "./models/ApplicationInterfaceDefinition";
+import BatchQueue from "./models/BatchQueue";
 
 const post = "post";
 const get = "get";
@@ -42,118 +42,173 @@ pagination:true # whether to treat the response as a paginated response
  */
 
 export default {
-  "ApplicationDeployments": {
+  ApplicationDeployments: {
     url: "/api/application-deployments",
-    viewSet: [{
-      name: "list"
-    }, {
-      name: "create"
-    }, {
-      name: "retrieve"
-    }, {
-      name: "update"
-    }, {
-      name: "delete"
-    }, {
-      name: "getQueues",
-      url: "/api/application-deployments/<lookup>/queues/",
-      requestType: 'get',
-      modelClass: BatchQueue
-    }],
-    queryParams: ['appModuleId', 'groupResourceProfileId'],
-    modelClass: ApplicationDeploymentDescription,
+    viewSet: [
+      {
+        name: "list"
+      },
+      {
+        name: "create"
+      },
+      {
+        name: "retrieve"
+      },
+      {
+        name: "update"
+      },
+      {
+        name: "delete"
+      },
+      {
+        name: "getQueues",
+        url: "/api/application-deployments/<lookup>/queues/",
+        requestType: "get",
+        modelClass: BatchQueue
+      }
+    ],
+    queryParams: ["appModuleId", "groupResourceProfileId"],
+    modelClass: ApplicationDeploymentDescription
   },
-  "ApplicationInterfaces": {
+  ApplicationInterfaces: {
     url: "/api/application-interfaces",
     viewSet: true,
-    modelClass: ApplicationInterfaceDefinition,
+    modelClass: ApplicationInterfaceDefinition
   },
-  "ApplicationModules": {
+  ApplicationModules: {
     url: "/api/applications",
-    viewSet: [{
-      name: "list"
-    }, {
-      name: "create"
-    }, {
-      name: "retrieve"
-    }, {
-      name: "update"
-    }, {
-      name: "delete"
-    }, {
-      name: "getApplicationInterface",
-      url: "/api/applications/<lookup>/application_interface/",
-      requestType: 'get',
-      modelClass: ApplicationInterfaceDefinition
-    }, {
-      name: "getApplicationDeployments",
-      url: "/api/applications/<lookup>/application_deployments/",
-      requestType: 'get',
-      modelClass: ApplicationDeploymentDescription
-    }, {
-      name: "listAll",
-      url: "/api/applications/list_all/",
-      requestType: 'get',
-      modelClass: ApplicationModule,
-    }],
-    modelClass: ApplicationModule,
+    viewSet: [
+      {
+        name: "list"
+      },
+      {
+        name: "create"
+      },
+      {
+        name: "retrieve"
+      },
+      {
+        name: "update"
+      },
+      {
+        name: "delete"
+      },
+      {
+        name: "getApplicationInterface",
+        url: "/api/applications/<lookup>/application_interface/",
+        requestType: "get",
+        modelClass: ApplicationInterfaceDefinition
+      },
+      {
+        name: "getApplicationDeployments",
+        url: "/api/applications/<lookup>/application_deployments/",
+        requestType: "get",
+        modelClass: ApplicationDeploymentDescription
+      },
+      {
+        name: "listAll",
+        url: "/api/applications/list_all/",
+        requestType: "get",
+        modelClass: ApplicationModule
+      }
+    ],
+    modelClass: ApplicationModule
   },
-  "ComputeResources": {
+  ComputeResources: {
     url: "/api/compute-resources",
-    viewSet: [{
-      name: "retrieve"
-    }, {
-      name: "names",
-      url: "/api/compute-resources/all_names/",
-      requestType: 'get',
-    }, {
-      name: "namesList",
-      url: "/api/compute-resources/all_names_list/",
-      requestType: 'get',
-    }],
-    modelClass: ComputeResourceDescription,
+    viewSet: [
+      {
+        name: "retrieve"
+      },
+      {
+        name: "names",
+        url: "/api/compute-resources/all_names/",
+        requestType: "get"
+      },
+      {
+        name: "namesList",
+        url: "/api/compute-resources/all_names_list/",
+        requestType: "get"
+      }
+    ],
+    modelClass: ComputeResourceDescription
   },
-  "CredentialSummaries": {
+  CredentialSummaries: {
     url: "/api/credential-summaries/",
-    viewSet: [{
-      name: "list"
-    }],
-    modelClass: CredentialSummary,
+    viewSet: [
+      {
+        name: "list"
+      },
+      {
+        name: "delete"
+      },
+      {
+        name: "allSSHCredentials",
+        url: "/api/credential-summaries/ssh/",
+        requestType: "get",
+        modelClass: CredentialSummary
+      },
+      {
+        name: "allPasswordCredentials",
+        url: "/api/credential-summaries/password/",
+        requestType: "get",
+        modelClass: CredentialSummary
+      },
+      {
+        name: "createSSH",
+        url: "/api/credential-summaries/create_ssh/",
+        requestType: "post",
+        modelClass: CredentialSummary
+      },
+      {
+        name: "createPassword",
+        url: "/api/credential-summaries/create_password/",
+        requestType: "post",
+        modelClass: CredentialSummary
+      }
+    ],
+    modelClass: CredentialSummary
   },
-  "GroupResourceProfiles": {
+  GroupResourceProfiles: {
     url: "/api/group-resource-profiles/",
     viewSet: true,
-    modelClass: GroupResourceProfile,
+    modelClass: GroupResourceProfile
   },
-  "Groups": {
+  Groups: {
     url: "/api/groups",
     viewSet: true,
     pagination: true,
-    queryParams: ['limit', 'offset'],
-    modelClass: Group,
+    queryParams: ["limit", "offset"],
+    modelClass: Group
   },
-  "SharedEntities": {
+  SharedEntities: {
     url: "/api/shared-entities",
-    viewSet: [{
-      name: "retrieve"
-    }, {
-      name: "update"
-    }, {
-      name: "merge",
-      url: "/api/shared-entities/<lookup>/merge/",
-      bodyParams: {
-        name: "data"
-      },
-      requestType: 'put',
-      modelClass: SharedEntity
-    }],
-    modelClass: SharedEntity,
+    viewSet: [
+      {
+        name: "retrieve"
+      },
+      {
+        name: "update"
+      },
+      {
+        name: "merge",
+        url: "/api/shared-entities/<lookup>/merge/",
+        bodyParams: {
+          name: "data"
+        },
+        requestType: "put",
+        modelClass: SharedEntity
+      }
+    ],
+    modelClass: SharedEntity
   },
-  "UserProfiles": {
+  UserProfiles: {
     url: "/api/user-profiles",
-    viewSet: [{
-      name: "list"
-    }],
-    modelClass: UserProfile,
-  },
-}
+    viewSet: [
+      {
+        name: "list"
+      }
+    ],
+    modelClass: UserProfile
+  }
+};
diff --git a/django_airavata/apps/api/urls.py b/django_airavata/apps/api/urls.py
index 5e4f0bf..7073252 100644
--- a/django_airavata/apps/api/urls.py
+++ b/django_airavata/apps/api/urls.py
@@ -9,19 +9,23 @@ logger = logging.getLogger(__name__)
 
 router = routers.DefaultRouter()
 router.register(r'projects', views.ProjectViewSet, base_name='project')
-router.register(r'experiments', views.ExperimentViewSet, base_name='experiment')
-router.register(r'full-experiments', views.FullExperimentViewSet, base_name='full-experiment')
-router.register(r'experiment-search', views.ExperimentSearchViewSet, base_name='experiment-search')
+router.register(r'experiments', views.ExperimentViewSet,
+                base_name='experiment')
+router.register(r'full-experiments', views.FullExperimentViewSet,
+                base_name='full-experiment')
+router.register(r'experiment-search', views.ExperimentSearchViewSet,
+                base_name='experiment-search')
 router.register(r'groups', views.GroupViewSet, base_name='group')
-router.register(r'new/application/module', views.RegisterApplicationModule, base_name='register_app_module')
-router.register(r'application-interfaces', views.ApplicationInterfaceViewSet, base_name='application-interface')
-router.register(r'applications', views.ApplicationModuleViewSet, base_name='application')
-router.register(r'application-deployments', views.ApplicationDeploymentViewSet, base_name='application-deployment')
+router.register(r'application-interfaces', views.ApplicationInterfaceViewSet,
+                base_name='application-interface')
+router.register(r'applications', views.ApplicationModuleViewSet,
+                base_name='application')
+router.register(r'application-deployments', views.ApplicationDeploymentViewSet,
+                base_name='application-deployment')
 router.register(r'user-profiles', views.UserProfileViewSet,
                 base_name='user-profile')
 router.register(r'group-resource-profiles', views.GroupResourceProfileViewSet,
                 base_name='group-resource-profile')
-router.register(r'shared/group/entities',views.SharedEntityGroups,base_name="shared_entities_with_groups")
 router.register(r'shared-entities', views.SharedEntityViewSet,
                 base_name='shared-entity')
 router.register(r'compute-resources', views.ComputeResourceViewSet,
@@ -32,31 +36,28 @@ router.register(r'credential-summaries', views.CredentialSummaryViewSet,
 app_name = 'django_airavata_api'
 urlpatterns = [
     url(r'^', include(router.urls)),
-    url(r'^new/application/module$', views.RegisterApplicationModule.as_view(), name='register_application_module'),
-    url(r'^new/application/interface$', views.RegisterApplicationInterface.as_view(),
-        name='register_application_interface'),
-    url(r'^new/application/deployment$', views.RegisterApplicationDeployments.as_view(),
-        name='register_application_deployments'),
-    url(r'^application/interfaces$', views.ApplicationInterfaceList.as_view(), name="app_interfaces"),
-    url(r'^application/interface$', views.FetchApplicationInterface.as_view(), name="app_interface"),
-    url(r'^application/deployment$', views.FetchApplicationDeployment.as_view(), name="app_deployment"),
-    url(r'^credentials/ssh/keys', views.FetchSSHPubKeys.as_view(), name="ssh_keys"),
-    url(r'^credentials/ssh/key/delete', views.DeleteSSHPubKey.as_view(), name="ssh_key_deletion"),
-    url(r'^credentials/ssh/key/create', views.GenerateRegisterSSHKeys.as_view(), name="ssh_key_creation"),
     url(r'^upload$', views.upload_input_file, name='upload_input_file'),
     url(r'^download', views.download_file, name='download_file'),
-    url(r'^credentials/ssh/key/create', views.GenerateRegisterSSHKeys.as_view(), name="ssh_key_creation"),
-    url(r'^job/submission/local', views.LocalJobSubmissionView.as_view(), name="local_job_submission"),
-    url(r'^job/submission/cloud', views.CloudJobSubmissionView.as_view(), name="cloud_job_submission"),
-    url(r'^job/submission/globus', views.GlobusJobSubmissionView.as_view(), name="globus_job_submission"),
-    url(r'^job/submission/ssh', views.SshJobSubmissionView.as_view(), name="ssh_job_submission"),
-    url(r'^job/submission/unicore', views.UnicoreJobSubmissionView.as_view(), name="unicore_job_submission"),
-    url(r'^data/movement/gridftp', views.GridFtpDataMovementView.as_view(), name="grid_ftp_data_movement"),
-    url(r'^data/movement/local', views.LocalDataMovementView.as_view(), name="local_ftp_data_movement"),
-    url(r'^data/movement/unicore', views.UnicoreDataMovementView.as_view(), name="unicore_ftp_data_movement"),
-    url(r'^data/movement/scp', views.ScpDataMovementView.as_view(), name="scp_ftp_data_movement"),
+    url(r'^job/submission/local', views.LocalJobSubmissionView.as_view(),
+        name="local_job_submission"),
+    url(r'^job/submission/cloud', views.CloudJobSubmissionView.as_view(),
+        name="cloud_job_submission"),
+    url(r'^job/submission/globus', views.GlobusJobSubmissionView.as_view(),
+        name="globus_job_submission"),
+    url(r'^job/submission/ssh', views.SshJobSubmissionView.as_view(),
+        name="ssh_job_submission"),
+    url(r'^job/submission/unicore', views.UnicoreJobSubmissionView.as_view(),
+        name="unicore_job_submission"),
+    url(r'^data/movement/gridftp', views.GridFtpDataMovementView.as_view(),
+        name="grid_ftp_data_movement"),
+    url(r'^data/movement/local', views.LocalDataMovementView.as_view(),
+        name="local_ftp_data_movement"),
+    url(r'^data/movement/unicore', views.UnicoreDataMovementView.as_view(),
+        name="unicore_ftp_data_movement"),
+    url(r'^data/movement/scp', views.ScpDataMovementView.as_view(),
+        name="scp_ftp_data_movement"),
 ]
 
 if logger.isEnabledFor(logging.DEBUG):
-    for url in router.urls:
-        logger.debug("router url: {}".format(url))
+    for router_url in router.urls:
+        logger.debug("router url: {}".format(router_url))
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index f0aee4a..a375e6b 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -7,6 +7,7 @@ from django.http import FileResponse, Http404, JsonResponse
 from django.urls import reverse
 from rest_framework import mixins
 from rest_framework import status
+from rest_framework.decorators import action
 from rest_framework.decorators import detail_route
 from rest_framework.decorators import list_route
 from rest_framework.exceptions import ParseError
@@ -20,7 +21,7 @@ from airavata.model.appcatalog.appinterface.ttypes import ApplicationInterfaceDe
 from airavata.model.appcatalog.computeresource.ttypes import ComputeResourceDescription, LOCALSubmission, \
     CloudJobSubmission, SSHJobSubmission, GlobusJobSubmission, UnicoreJobSubmission
 from airavata.model.application.io.ttypes import DataType
-from airavata.model.credential.store.ttypes import CredentialOwnerType, SummaryType, CredentialSummary
+from airavata.model.credential.store.ttypes import SummaryType, CredentialSummary
 from airavata.model.data.movement.ttypes import GridFTPDataMovement, LOCALDataMovement, SCPDataMovement, \
     UnicoreDataMovement
 from airavata.api.error.ttypes import ProjectNotFoundException
@@ -326,45 +327,6 @@ class ApplicationModuleViewSet(APIBackedViewSet):
         return Response(serializer.data)
 
 
-# TODO convert to APIBackedViewSet
-class RegisterApplicationModule(APIView):
-    parser_classes = (JSONParser,)
-
-    def post(self, request, format=None):
-        gateway_id = settings.GATEWAY_ID
-        app_module = ApplicationModule(request.data['name'], request.data['version'], request.data['description'])
-        response = request.airavata_client.registerApplicationModule(request.authz_token, gateway_id, app_module)
-        return Response(response)
-
-
-# TODO use ApplicationInterfaceViewSet instead
-class RegisterApplicationInterface(APIView):
-    parser_classes = (JSONParser,)
-
-    def post(self, request, format=None):
-        gateway_id = settings.GATEWAY_ID
-        params = request.data
-        app_interface_description_serializer = serializers.ApplicationInterfaceDescriptionSerializer(data=params)
-        app_interface_description_serializer.is_valid(raise_exception=True)
-        app_interface = app_interface_description_serializer.save()
-        response = request.airavata_client.registerApplicationInterface(request.authz_token, gateway_id,
-                                                                        applicationInterface=app_interface)
-        return Response(response)
-
-
-# TODO convert to APIBackedViewSet
-class RegisterApplicationDeployments(APIView):
-    parser_classes = (JSONParser,)
-
-    def post(self, request, format=None):
-        gateway_id = settings.GATEWAY_ID
-        params = request.data
-        app_deployment = ApplicationDeploymentDescription(**params)
-        response = request.airavata_client.registerApplicationDeployment(request.authz_token, gateway_id,
-                                                                         app_deployment)
-        return Response(response)
-
-
 class ApplicationInterfaceViewSet(APIBackedViewSet):
     serializer_class = serializers.ApplicationInterfaceDescriptionSerializer
     lookup_field = 'app_interface_id'
@@ -459,87 +421,6 @@ class ApplicationDeploymentViewSet(APIBackedViewSet):
         return Response(serializer.data)
 
 
-class ComputeResourcesQueues(APIView):
-    renderer_classes = (JSONRenderer,)
-
-    def get(self, request, format=None):
-        details = request.airavata_client.getComputeResource(request.authz_token, request.query_params["id"])
-        serializer = thrift_utils.create_serializer(ComputeResourceDescription, instance=details,
-                                                    context={'request': request})
-        data = serializer.data
-        return Response([queue["queueName"] for queue in data["batchQueues"]])
-
-
-class ApplicationInterfaceList(APIView):
-    def get(self, request, format=None):
-        gateway_id = settings.GATEWAY_ID
-        serializer = thrift_utils.create_serializer(ApplicationInterfaceDescription,
-                                                    instance=request.airavata_client.getAllApplicationInterfaces(
-                                                        request.authz_token, gateway_id),
-                                                    context={'request': request}, many=True)
-        return Response(serializer.data)
-
-
-class FetchApplicationInterface(APIView):
-
-    def get(self, request, format=None):
-        gateway_id = settings.GATEWAY_ID
-        for app_interface in request.airavata_client.getAllApplicationInterfaces(
-                request.authz_token, gateway_id):
-            app_modules = app_interface.applicationModules
-            if request.query_params["id"] in app_modules:
-                return Response(thrift_utils.create_serializer(ApplicationInterfaceDescription,
-                                                               instance=app_interface,
-                                                               context={'request': request}).data)
-        return Response(status=status.HTTP_400_BAD_REQUEST)
-
-
-class FetchApplicationDeployment(APIView):
-
-    def get(self, request, format=None):
-        gateway_id = settings.GATEWAY_ID
-        app_deployments = [app_deployment for app_deployment in request.airavata_client.getAllApplicationDeployments(
-            request.authz_token, gateway_id) if request.query_params["id"] == app_deployment.appModuleId]
-        serializer = thrift_utils.create_serializer(ApplicationDeploymentDescription,
-                                                    instance=app_deployments,
-                                                    context={'request': request}, many=True)
-        return Response(serializer.data)
-        # return Response(request.airavata_client.getAppModuleDeployedResources(request.authz_token, request.query_params["id"]))
-
-
-class FetchSSHPubKeys(APIView):
-
-    def get(self, request, format=None):
-        gateway_id = settings.GATEWAY_ID
-        serializer = thrift_utils.create_serializer(CredentialSummary,
-                                                    instance=request.airavata_client.getAllCredentialSummaryForGateway(
-                                                        request.authz_token, SummaryType.SSH, gateway_id),
-                                                    context={'request': request}, many=True)
-        return Response(serializer.data)
-
-
-class GenerateRegisterSSHKeys(APIView):
-    parser_classes = (JSONParser,)
-    renderer_classes = (JSONRenderer,)
-
-    def post(self, request, format=None):
-        username = request.user.username
-        gateway_id = settings.GATEWAY_ID
-        data = request.data
-        return Response(request.airavata_client.generateAndRegisterSSHKeys(request.authz_token, gateway_id, username,
-                                                                           data["description"],
-                                                                           CredentialOwnerType.GATEWAY))
-
-
-class DeleteSSHPubKey(APIView):
-    parser_classes = (JSONParser,)
-    renderer_classes = (JSONRenderer,)
-
-    def post(self, request, format=None):
-        gateway_id = settings.GATEWAY_ID
-        return Response(request.airavata_client.deleteSSHPubKey(request.authz_token, request.data['token'], gateway_id))
-
-
 class ComputeResourceViewSet(mixins.RetrieveModelMixin,
                              GenericAPIBackedViewSet):
     serializer_class = serializers.ComputeResourceDescriptionSerializer
@@ -761,39 +642,6 @@ class GroupResourceProfileViewSet(APIBackedViewSet):
             self.authz_token, instance.groupResourceProfileId)
 
 
-class SharedEntityGroups(APIBackedViewSet):
-    serializer_class = serializers.SharedGroups
-
-    def perform_update(self, serializer):
-        before = serializer.data
-        after = serializer.initial_data
-        del serializer._data
-        remaining = [item for item in before["groupList"] if item not in after["groupList"]]
-        params = dict(after)
-        params["domainId"] = settings.GATEWAY_ID
-        params["permissionTypeId"] = READ_PERMISSION_TYPE.format(settings.GATEWAY_ID)
-        params["cascadePermission"] = True
-        ret = self.request.sharing_client.shareEntityWithGroups(**params)
-        if remaining:
-            self.request.sharing_client.revokeEntitySharingFromGroups(domainId=settings.GATEWAY_ID,
-                                                                      entityId=before["entityId"], groupList=remaining,
-                                                                      permissionTypeId=READ_PERMISSION_TYPE.format(
-                                                                          settings.GATEWAY_ID))
-        serializer.save()
-
-    def get_instance(self, entity_id):
-        groups = {
-            'entityId': entity_id
-        }
-        group_list = self.request.sharing_client.getListOfSharedGroups(domainId=settings.GATEWAY_ID, entityId=entity_id,
-                                                                       permissionTypeId=READ_PERMISSION_TYPE.format(
-                                                                           settings.GATEWAY_ID))
-        if group_list:
-            group_list = map(lambda val: val.groupId, group_list)
-        groups['groupList'] = group_list
-        return groups
-
-
 class SharedEntityViewSet(mixins.RetrieveModelMixin,
                           mixins.UpdateModelMixin,
                           GenericAPIBackedViewSet):
@@ -939,6 +787,59 @@ class CredentialSummaryViewSet(mixins.ListModelMixin,
     serializer_class = serializers.CredentialSummarySerializer
 
     def get_list(self):
-        # NOTE: only supported SummaryType is SSH for now
-        return self.request.airavata_client.getAllCredentialSummaryForGateway(
-            self.authz_token, SummaryType.SSH, settings.GATEWAY_ID)
+        ssh_creds = self.request.airavata_client.getAllCredentialSummaries(
+            self.authz_token, SummaryType.SSH)
+        pwd_creds = self.request.airavata_client.getAllCredentialSummaries(
+            self.authz_token, SummaryType.PASSWD)
+        return ssh_creds + pwd_creds
+
+    @action(detail=False)
+    def ssh(self, request):
+        summaries = self.request.airavata_client.getAllCredentialSummaries(
+            self.authz_token, SummaryType.SSH
+        )
+        serializer = self.get_serializer(summaries, many=True)
+        return Response(serializer.data)
+
+    @action(detail=False)
+    def password(self, request):
+        summaries = self.request.airavata_client.getAllCredentialSummaries(
+            self.authz_token, SummaryType.PASSWD
+        )
+        serializer = self.get_serializer(summaries, many=True)
+        return Response(serializer.data)
+
+    @action(methods=['post'], detail=False)
+    def create_ssh(self, request):
+        description = request.POST.get('description')
+        if description is None:
+            raise ParseError("'description' is required in request")
+        token_id = self.request.airavata_client.generateAndRegisterSSHKeys(
+            request.authz_token, description)
+        credential_summary = self.request.airavata_client.getCredentialSummary(
+            request.authz_token, SummaryType.SSH, token_id)
+        serializer = self.get_serializer(credential_summary)
+        return Response(serializer.data)
+
+    @action(methods=['post'], detail=False)
+    def create_password(self, request):
+        username = request.POST.get('username')
+        password = request.POST.get('password')
+        description = request.POST.get('description')
+        if username is None or password is None or description is None:
+            raise ParseError("'username', 'password' and 'description' "
+                             "are all required in request")
+        token_id = self.request.airavata_client.registerPwdCredential(
+            request.authz_token, username, password, description)
+        credential_summary = self.request.airavata_client.getCredentialSummary(
+            request.authz_token, SummaryType.PASSWD, token_id)
+        serializer = self.get_serializer(credential_summary)
+        return Response(serializer.data)
+
+    def perform_destroy(self, instance):
+        if instance.type == SummaryType.SSH:
+            self.request.airavata_client.deleteSSHPubKey(
+                self.authz_token, instance.token)
+        elif instance.type == SummaryType.PASSWD:
+            self.request.airavata_client.deletePWDCredential(
+                self.authz_token, instance.token)