You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by is...@apache.org on 2021/07/14 18:50:31 UTC

[airavata-custos-portal] branch custos-pearc-tutorial-2021 updated: Fix the roles and user profile

This is an automated email from the ASF dual-hosted git repository.

isjarana pushed a commit to branch custos-pearc-tutorial-2021
in repository https://gitbox.apache.org/repos/asf/airavata-custos-portal.git


The following commit(s) were added to refs/heads/custos-pearc-tutorial-2021 by this push:
     new 6253d18  Fix the roles and user profile
     new 3d843da  Merge pull request #111 from dinukadesilva/reference-student-portal
6253d18 is described below

commit 6253d18b8d603124aeb8bf1078352d36723c93f2
Author: Dinuka De Silva <l....@gmail.com>
AuthorDate: Wed Jul 14 14:48:21 2021 -0400

    Fix the roles and user profile
---
 README.md                                    |  4 +-
 docker-compose.yml                           |  4 +-
 entrypoint.sh                                |  2 +-
 src/config.js                                |  8 ++--
 src/lib/components/pages/TenantEntities.vue  | 20 ++++----
 src/lib/components/pages/TenantHome.vue      |  8 ++--
 src/lib/components/pages/TenantNewEntity.vue |  6 +--
 src/lib/components/pages/TenantUser.vue      | 68 +++++-----------------------
 8 files changed, 38 insertions(+), 82 deletions(-)

diff --git a/README.md b/README.md
index 860875f..82df2ad 100644
--- a/README.md
+++ b/README.md
@@ -18,11 +18,11 @@ VUE_APP_CLIENT_ENTITY_TYPE_ID_SUBMISSION="PATIENT_HISTORY"
 VUE_APP_CLIENT_ENTITY_TYPE_ID_GRADING="PRESCRIPTION"
 
 VUE_APP_CLIENT_ROLE_PROFESSOR="doctor"
-VUE_APP_CLIENT_ROLE_RESEARCH_ASSISTANT="nurse"
+VUE_APP_CLIENT_ROLE_TEACHING_ASSISTANT="nurse"
 VUE_APP_CLIENT_ROLE_STUDENT="patient"
 
 VUE_APP_CLIENT_GROUP_ID_STUDENT=""
-VUE_APP_CLIENT_GROUP_ID_RESEARCH_ASSISTANT=""
+VUE_APP_CLIENT_GROUP_ID_TEACHING_ASSISTANT=""
 
 VUE_APP_CLIENT_PERMISSION_TYPE_VIEWER="VIEWER"
 VUE_APP_CLIENT_PERMISSION_TYPE_EDITOR="EDITOR"
diff --git a/docker-compose.yml b/docker-compose.yml
index a155fed..093a84f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -17,11 +17,11 @@ services:
       VUE_APP_CLIENT_ENTITY_TYPE_ID_GRADING: 'GRADING'
 
       VUE_APP_CLIENT_ROLE_PROFESSOR: 'professor'
-      VUE_APP_CLIENT_ROLE_RESEARCH_ASSISTANT: 'research-assistant'
+      VUE_APP_CLIENT_ROLE_TEACHING_ASSISTANT: 'teaching-assistant'
       VUE_APP_CLIENT_ROLE_STUDENT: 'student'
 
       VUE_APP_CLIENT_GROUP_ID_STUDENT: ''
-      VUE_APP_CLIENT_GROUP_ID_RESEARCH_ASSISTANT: ''
+      VUE_APP_CLIENT_GROUP_ID_TEACHING_ASSISTANT: ''
 
       VUE_APP_CLIENT_PERMISSION_TYPE_VIEWER: 'VIEWER'
       VUE_APP_CLIENT_PERMISSION_TYPE_EDITOR: 'EDITOR'
diff --git a/entrypoint.sh b/entrypoint.sh
index 56c9e88..c747923 100644
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -11,7 +11,7 @@ do
     cp $file $file.tmpl.js
   fi
 
-  envsubst '$VUE_APP_CLIENT_ID,$VUE_APP_CLIENT_SEC,$VUE_APP_REDIRECT_URI,$VUE_APP_CLIENT_ENTITY_TYPE_ID_ASSIGNMENT,$VUE_APP_CLIENT_ENTITY_TYPE_ID_SUBMISSION,$VUE_APP_CLIENT_ENTITY_TYPE_ID_GRADING,$VUE_APP_CLIENT_ROLE_PROFESSOR,$VUE_APP_CLIENT_ROLE_RESEARCH_ASSISTANT,$VUE_APP_CLIENT_ROLE_STUDENT,$VUE_APP_CLIENT_GROUP_ID_STUDENT,$VUE_APP_CLIENT_GROUP_ID_RESEARCH_ASSISTANT,$VUE_APP_CLIENT_PERMISSION_TYPE_VIEWER,$VUE_APP_CLIENT_PERMISSION_TYPE_EDITOR' < $file.tmpl.js > $file
+  envsubst '$VUE_APP_CLIENT_ID,$VUE_APP_CLIENT_SEC,$VUE_APP_REDIRECT_URI,$VUE_APP_CLIENT_ENTITY_TYPE_ID_ASSIGNMENT,$VUE_APP_CLIENT_ENTITY_TYPE_ID_SUBMISSION,$VUE_APP_CLIENT_ENTITY_TYPE_ID_GRADING,$VUE_APP_CLIENT_ROLE_PROFESSOR,$VUE_APP_CLIENT_ROLE_TEACHING_ASSISTANT,$VUE_APP_CLIENT_ROLE_STUDENT,$VUE_APP_CLIENT_GROUP_ID_STUDENT,$VUE_APP_CLIENT_GROUP_ID_TEACHING_ASSISTANT,$VUE_APP_CLIENT_PERMISSION_TYPE_VIEWER,$VUE_APP_CLIENT_PERMISSION_TYPE_EDITOR' < $file.tmpl.js > $file
 done
 
 echo "Starting Nginx"
diff --git a/src/config.js b/src/config.js
index c9db16e..681079c 100644
--- a/src/config.js
+++ b/src/config.js
@@ -7,11 +7,11 @@ dotenv.config()
 // VUE_APP_CLIENT_ENTITY_TYPE_ID_GRADING="PRESCRIPTION"
 //
 // VUE_APP_CLIENT_ROLE_PROFESSOR="doctor"
-// VUE_APP_CLIENT_ROLE_RESEARCH_ASSISTANT="nurse"
+// VUE_APP_CLIENT_ROLE_TEACHING_ASSISTANT="nurse"
 // VUE_APP_CLIENT_ROLE_STUDENT="patient"
 //
 // VUE_APP_CLIENT_GROUP_ID_STUDENT="group-1_2ea05c80-bb66-40dc-851f-4c5665402234"
-// VUE_APP_CLIENT_GROUP_ID_RESEARCH_ASSISTANT="dfsd_3fb3b140-9693-4e70-9898-e1eafde05d3b"
+// VUE_APP_CLIENT_GROUP_ID_TEACHING_ASSISTANT="dfsd_3fb3b140-9693-4e70-9898-e1eafde05d3b"
 //
 // VUE_APP_CLIENT_PERMISSION_TYPE_VIEWER="VIEWER"
 // VUE_APP_CLIENT_PERMISSION_TYPE_EDITOR="EDITOR"
@@ -28,10 +28,10 @@ export default class Configuration {
             entityTypeIdSubmission: '$VUE_APP_CLIENT_ENTITY_TYPE_ID_SUBMISSION',
             entityTypeIdGrading: '$VUE_APP_CLIENT_ENTITY_TYPE_ID_GRADING',
             clientRoleProfessor: '$VUE_APP_CLIENT_ROLE_PROFESSOR',
-            clientRoleResearchAssistant: '$VUE_APP_CLIENT_ROLE_RESEARCH_ASSISTANT',
+            clientRoleTeachingAssistant: '$VUE_APP_CLIENT_ROLE_TEACHING_ASSISTANT',
             clientRoleStudent: '$VUE_APP_CLIENT_ROLE_STUDENT',
             groupIdStudent: '$VUE_APP_CLIENT_GROUP_ID_STUDENT',
-            groupIdResearchAssistant: '$VUE_APP_CLIENT_GROUP_ID_RESEARCH_ASSISTANT',
+            groupIdTeachingAssistant: '$VUE_APP_CLIENT_GROUP_ID_TEACHING_ASSISTANT',
             permissionTypeViewer: '$VUE_APP_CLIENT_PERMISSION_TYPE_VIEWER',
             permissionTypeEditor: '$VUE_APP_CLIENT_PERMISSION_TYPE_EDITOR',
             // permissionTypeShare: '$VUE_APP_CLIENT_PERMISSION_TYPE_SHARE'
diff --git a/src/lib/components/pages/TenantEntities.vue b/src/lib/components/pages/TenantEntities.vue
index 29f093a..4906a18 100644
--- a/src/lib/components/pages/TenantEntities.vue
+++ b/src/lib/components/pages/TenantEntities.vue
@@ -6,7 +6,7 @@
       </router-link>
     </template>
     <table-overlay-info :rows="5" :columns="1" :data="assignments"
-                        v-if="hasStudentRole || hasResearchAssistantRole || hasProfessorRole">
+                        v-if="hasStudentRole || hasTeachingAssistantRole || hasProfessorRole">
       <div v-for="(assignment, assignmentIndex) in assignments" :key="assignmentIndex">
         <div style="background-color: #f9f9f9;padding: 15px;margin-bottom: 10px;border-radius: 10px;">
           <div style="display: flex; flex-direction: row;">
@@ -137,7 +137,7 @@
                           </div>
                           <div v-else>
                             <b-button
-                                v-if="(hasProfessorRole || hasResearchAssistantRole) && hasPermission(studentSubmission.submission, permissionTypeViewer)"
+                                v-if="(hasProfessorRole || hasTeachingAssistantRole) && hasPermission(studentSubmission.submission, permissionTypeViewer)"
                                 variant="link" size="sm"
                                 v-on:click="addNewGrading(assignment, studentSubmission.submission)">
                               + Create grading
@@ -277,7 +277,7 @@
             <!--                  </ul>-->
 
             <!--                  <b-button-->
-            <!--                      v-if="(hasProfessorRole || hasResearchAssistantRole) && hasPermission(submission, permissionTypeViewer)"-->
+            <!--                      v-if="(hasProfessorRole || hasTeachingAssistantRole) && hasPermission(submission, permissionTypeViewer)"-->
             <!--                      variant="link" size="sm"-->
             <!--                      v-on:click="addNewGrading(assignment, submission)">-->
             <!--                    + Create new submission grading-->
@@ -328,11 +328,11 @@ const entityTypeIdSubmission = config.value('entityTypeIdSubmission');
 const entityTypeIdGrading = config.value('entityTypeIdGrading');
 
 const clientRoleProfessor = config.value('clientRoleProfessor');
-const clientRoleResearchAssistant = config.value('clientRoleResearchAssistant');
+const clientRoleTeachingAssistant = config.value('clientRoleTeachingAssistant');
 const clientRoleStudent = config.value('clientRoleStudent');
 
 const groupIdStudent = config.value('groupIdStudent');
-const groupIdResearchAssistant = config.value('groupIdResearchAssistant');
+const groupIdTeachingAssistant = config.value('groupIdTeachingAssistant');
 
 const permissionTypeViewer = config.value('permissionTypeViewer');
 const permissionTypeEditor = config.value('permissionTypeEditor');
@@ -362,7 +362,7 @@ export default {
   },
   computed: {
     title() {
-      if (this.hasStudentRole || this.hasResearchAssistantRole || this.hasProfessorRole) {
+      if (this.hasStudentRole || this.hasTeachingAssistantRole || this.hasProfessorRole) {
         return "Assignments";
       } else {
         return "Unauthorized";
@@ -392,8 +392,8 @@ export default {
     hasProfessorRole() {
       return this.currentUser && this.currentUser.realmRoles.indexOf(clientRoleProfessor) >= 0;
     },
-    hasResearchAssistantRole() {
-      return this.currentUser && this.currentUser.realmRoles.indexOf(clientRoleResearchAssistant) >= 0;
+    hasTeachingAssistantRole() {
+      return this.currentUser && this.currentUser.realmRoles.indexOf(clientRoleTeachingAssistant) >= 0;
     },
     hasStudentRole() {
       return this.currentUser && this.currentUser.realmRoles.indexOf(clientRoleStudent) >= 0;
@@ -539,7 +539,7 @@ export default {
           entityId: submission.entityId,
           clientId: this.clientId,
           permissionTypeId: permissionTypeViewer,
-          groupIds: [groupIdResearchAssistant],
+          groupIds: [groupIdTeachingAssistant],
           usernames: [assignment.ownerId],
         });
       }
@@ -557,7 +557,7 @@ export default {
           entityId: grading.entityId,
           clientId: this.clientId,
           permissionTypeId: permissionTypeViewer,
-          groupIds: [groupIdResearchAssistant],
+          groupIds: [groupIdTeachingAssistant],
           usernames: [assignment.ownerId],
         });
       }
diff --git a/src/lib/components/pages/TenantHome.vue b/src/lib/components/pages/TenantHome.vue
index 34bf6fa..b080874 100644
--- a/src/lib/components/pages/TenantHome.vue
+++ b/src/lib/components/pages/TenantHome.vue
@@ -12,7 +12,7 @@
       <!--      </div>-->
       <div>
         <strong v-if="hasProfessorRole">Professor view</strong>
-        <strong v-else-if="hasResearchAssistantRole">ResearchAssistant view</strong>
+        <strong v-else-if="hasTeachingAssistantRole">TeachingAssistant view</strong>
         <strong v-else-if="hasStudentRole">Student view</strong>
         <strong v-else>The roles are not assigned.</strong>
       </div>
@@ -138,7 +138,7 @@ import {custosService} from "../../store/util/custos.util";
 import config from "../../../config";
 
 const clientRoleProfessor = config.value('clientRoleProfessor');
-const clientRoleResearchAssistant = config.value('clientRoleResearchAssistant');
+const clientRoleTeachingAssistant = config.value('clientRoleTeachingAssistant');
 const clientRoleStudent = config.value('clientRoleStudent');
 
 export default {
@@ -199,8 +199,8 @@ export default {
     hasProfessorRole() {
       return this.currentUser && this.currentUser.realmRoles.indexOf(clientRoleProfessor) >= 0;
     },
-    hasResearchAssistantRole() {
-      return this.currentUser && this.currentUser.realmRoles.indexOf(clientRoleResearchAssistant) >= 0;
+    hasTeachingAssistantRole() {
+      return this.currentUser && this.currentUser.realmRoles.indexOf(clientRoleTeachingAssistant) >= 0;
     },
     hasStudentRole() {
       return this.currentUser && this.currentUser.realmRoles.indexOf(clientRoleStudent) >= 0;
diff --git a/src/lib/components/pages/TenantNewEntity.vue b/src/lib/components/pages/TenantNewEntity.vue
index 31869d0..e5a12b2 100644
--- a/src/lib/components/pages/TenantNewEntity.vue
+++ b/src/lib/components/pages/TenantNewEntity.vue
@@ -55,11 +55,11 @@ import config from "../../../config";
 // const entityTypeIdGrading = config.value('entityTypeIdGrading');
 
 // const clientRoleProfessor = config.value('clientRoleProfessor');
-// const clientRoleResearchAssistant = config.value('clientRoleResearchAssistant');
+// const clientRoleTeachingAssistant = config.value('clientRoleTeachingAssistant');
 // const clientRoleStudent = config.value('clientRoleStudent');
 
 const groupIdStudent = config.value('groupIdStudent');
-const groupIdResearchAssistant = config.value('groupIdResearchAssistant');
+const groupIdTeachingAssistant = config.value('groupIdTeachingAssistant');
 
 // const permissionTypeViewer = config.value('permissionTypeViewer');
 const permissionTypeEditor = config.value('permissionTypeEditor');
@@ -157,7 +157,7 @@ export default {
             entityId: entityId,
             clientId: this.clientId,
             permissionTypeId: permissionTypeEditor,
-            groupIds: [groupIdStudent, groupIdResearchAssistant]
+            groupIds: [groupIdStudent, groupIdTeachingAssistant]
           });
 
           await this.$router.push(`/tenants/${this.clientId}/entities`);
diff --git a/src/lib/components/pages/TenantUser.vue b/src/lib/components/pages/TenantUser.vue
index a32777b..9546e06 100644
--- a/src/lib/components/pages/TenantUser.vue
+++ b/src/lib/components/pages/TenantUser.vue
@@ -76,7 +76,7 @@
 
         </div>
 
-        <div style="flex: 1;padding-left: 10px;" v-if="hasStudentRole">
+        <div style="flex: 1;padding-left: 10px;">
           <div>
             <div class="pt-3 text-left">
               <label class="form-label" for="age">Age</label>
@@ -131,31 +131,6 @@
           </div>
         </div>
 
-        <div style="flex: 1;padding-left: 10px;" v-if="hasProfessorRole">
-          <div class="pt-3 text-left">
-            <label class="form-label" for="professorSpecialization">Professor Specialization</label>
-            <b-form-select
-                :options="availableProfessorSpecializations"
-                v-model="professorSpecialization"
-                id="professorSpecialization"
-                trim
-                size="sm">
-            </b-form-select>
-          </div>
-        </div>
-
-        <div style="flex: 1;padding-left: 10px;" v-if="hasResearchAssistantRole">
-          <div class="pt-3 text-left">
-            <label class="form-label" for="nursingSpecialization">Nursing Specialization</label>
-            <b-form-select
-                :options="availableNursingSpecializations"
-                v-model="nursingSpecialization"
-                id="nursingSpecialization"
-                trim
-                size="sm">
-            </b-form-select>
-          </div>
-        </div>
 
       </div>
     </b-overlay>
@@ -173,7 +148,7 @@ import {
 import config from "../../../config";
 
 const clientRoleProfessor = config.value('clientRoleProfessor');
-const clientRoleResearchAssistant = config.value('clientRoleResearchAssistant');
+const clientRoleTeachingAssistant = config.value('clientRoleTeachingAssistant');
 const clientRoleStudent = config.value('clientRoleStudent');
 
 export default {
@@ -197,13 +172,8 @@ export default {
       gender: "",
       address: "",
       mobile: "",
-
-      professorSpecialization: "",
-      nursingSpecialization: "",
-
+      
       availableGenders: ["Male", "Female", "Prefer not to mention"],
-      availableProfessorSpecializations: ["Surgery", "Physician", "Cardiology", "Radiology"],
-      availableNursingSpecializations: ["ICU", "Surgical", "Emergency Care"],
 
       rolesToBeDisabled: ["uma_authorization", "offline_access", "admin"],
 
@@ -214,8 +184,8 @@ export default {
     hasProfessorRole() {
       return this.user && this.user.realmRoles.indexOf(clientRoleProfessor) >= 0;
     },
-    hasResearchAssistantRole() {
-      return this.user && this.user.realmRoles.indexOf(clientRoleResearchAssistant) >= 0;
+    hasTeachingAssistantRole() {
+      return this.user && this.user.realmRoles.indexOf(clientRoleTeachingAssistant) >= 0;
     },
     hasStudentRole() {
       return this.user && this.user.realmRoles.indexOf(clientRoleStudent) >= 0;
@@ -334,27 +304,13 @@ export default {
     selectedAttributes() {
       let _attributes = [];
 
-      if (this.hasStudentRole) {
-        _attributes = _attributes.concat([
-          {"key": "age", "values": [this.age]},
-          {"key": "gender", "values": [this.gender]},
-          {"key": "dateOfBirth", "values": [this.dateOfBirth]},
-          {"key": "address", "values": [this.address]},
-          {"key": "mobile", "values": [this.mobile]}
-        ]);
-      }
-
-      if (this.hasResearchAssistantRole) {
-        _attributes = _attributes.concat([
-          {"key": "nursingSpecialization", "values": [this.nursingSpecialization]}
-        ]);
-      }
-
-      if (this.hasProfessorRole) {
-        _attributes = _attributes.concat([
-          {"key": "professorSpecialization", "values": [this.professorSpecialization]}
-        ]);
-      }
+      _attributes = _attributes.concat([
+        {"key": "age", "values": [this.age]},
+        {"key": "gender", "values": [this.gender]},
+        {"key": "dateOfBirth", "values": [this.dateOfBirth]},
+        {"key": "address", "values": [this.address]},
+        {"key": "mobile", "values": [this.mobile]}
+      ]);
 
       return _attributes;
     }