Skip to content

Commit

Permalink
Merge pull request #962 from opencb/TASK-6494
Browse files Browse the repository at this point in the history
TASK-6494 - Adapt IVA to OpenCGA user data model changes
  • Loading branch information
gpveronica authored Aug 23, 2024
2 parents 1aa01c0 + 6d50ec9 commit ff6e17a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
5 changes: 3 additions & 2 deletions src/webcomponents/api/rest-utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// ********************************************************************
// 0. Functions for checking if the param is: enum | primitive | object
// ********************************************************************
import UtilsNew from "../../core/utils-new";
import UtilsNew from "../../core/utils-new.js";
import CatalogUtils from "../../core/clients/opencga/opencga-catalog-utils.js";

export default {

Expand Down Expand Up @@ -39,7 +40,7 @@ export default {
},

isAdministrator(opencgaSession) {
return opencgaSession?.user?.account?.type === "ADMINISTRATOR" || opencgaSession?.user.id === "OPENCGA";
return opencgaSession?.user?.id?.toUpperCase() === "OPENCGA" || CatalogUtils.isOrganizationAdmin(opencgaSession?.organization, opencgaSession?.user?.id);
},

sortArray(elements) {
Expand Down
7 changes: 2 additions & 5 deletions src/webcomponents/study/admin/study-admin-users.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,6 @@ export default class StudyAdminUsers extends LitElement {
{
title: "User Name",
field: "name",
formatter: (value, row) => {
return value === this.owner ? `<span style="font-weight: bold">${value} (owner)</span>` : value;
},
rowspan: 2,
colspan: 1,
sortable: true
Expand All @@ -252,8 +249,8 @@ export default class StudyAdminUsers extends LitElement {
},
{
title: "Created on",
field: "account.creationDate",
formatter: (value, row) => {
field: "creationDate",
formatter: value => {
return value ? UtilsNew.dateFormatter(value) : "NA";
},
rowspan: 2,
Expand Down
14 changes: 5 additions & 9 deletions src/webcomponents/user/user-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,21 @@ export default class UserInfo extends LitElement {
defaultValue: "-",
},
},
{
title: "Account type",
field: "account.type"
},
{
title: "Member since",
field: "account.creationDate",
field: "creationDate",
display: {
defaultValue: "Not provided",
format: date => UtilsNew.dateFormatter(date)
}
},
{
title: "Synced from",
field: "account.authentication",
// CAUTION 20240229 VERO: bug in visible function:
// the argument authentication is the entire data model, not the field account.authentication
field: "internal.account.authentication",
display: {
visible: authentication => authentication.id === "internal",
visible: user => {
return user?.internal?.account?.authentication?.id !== "OPENCGA";
},
format: authentication => authentication.id,
}
}
Expand Down

0 comments on commit ff6e17a

Please sign in to comment.