From 1c5a0b22a8bd977eb77edded7f00ad3b56edccf6 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 5 Oct 2023 14:31:37 +0300 Subject: [PATCH 1/2] restrict links to user roles management to portal Admins --- login/user.component.html | 8 ++++---- login/user.component.ts | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/login/user.component.html b/login/user.component.html index a69412e4..45cb0d51 100644 --- a/login/user.component.html +++ b/login/user.component.html @@ -17,13 +17,13 @@
Roles {{getTheRolesFormatted(user.role)}}
-
- + Manage your roles {{" "}} - Manage role requests{{" "}} - Manage users
diff --git a/login/user.component.ts b/login/user.component.ts index e279b7b6..f95adf67 100644 --- a/login/user.component.ts +++ b/login/user.component.ts @@ -100,12 +100,9 @@ export class UserComponent { return formattedRoles.join(", "); } - get isCurator() { - return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user); + get isPortalAdministrator() { + return Session.isPortalAdministrator(this.user); } - get isUserManager() { - return Session.isUserManager(this.user); - } } From 445441572d30bb2c6cd889abfb62bc225e87de98 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 6 Oct 2023 12:22:00 +0300 Subject: [PATCH 2/2] [Library & Explore | develop]: Added software heritage as pid for research products. 1. environments/: Added in all environments, property: swhURL: "https://archive.softwareheritage.org/". 2. env-properties.ts: Added property swhURL?: string; 3. string-utils.class.ts: Added method "isValidSwhId()" and swhid in checks and definitions. 4. resultLandingInfo.ts: Added swhid in accepted types of interface Id. 5. resultLanding.component.ts: Added check for swhid in "getReferenceIdName()" and "getReferenceUrl()". 6. parsingFunctions.class.ts: Added pid[i].classid == "swhid" check in "parseIdentifiers()". 7. showIdentifiers.component.ts: Added "swhid" in display of pids. --- landingPages/landing-utils/parsingFunctions.class.ts | 6 ++++-- .../landing-utils/showIdentifiers.component.ts | 4 +++- landingPages/result/resultLanding.component.ts | 4 ++++ utils/entities/resultLandingInfo.ts | 2 +- utils/properties/env-properties.ts | 1 + utils/string-utils.class.ts | 12 ++++++++++-- 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index fd2c3b12..faeaaada 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -514,7 +514,8 @@ export class ParsingFunctions { let identifiers = new Map(); if (pid.hasOwnProperty("classid") && pid['classid'] != "") { - if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data") { + if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data" + || pid.classid == "swhid") { if (!identifiers.has(pid.classid)) { identifiers.set(pid.classid, new Array()); } @@ -522,7 +523,8 @@ export class ParsingFunctions { } } else { for (let i = 0; i < pid.length; i++) { - if (pid[i].classid == "doi" || pid[i].classid == "pmc" || pid[i].classid == "handle" || pid[i].classid == "pmid" || pid[i].classid == "re3data") { + if (pid[i].classid == "doi" || pid[i].classid == "pmc" || pid[i].classid == "handle" || pid[i].classid == "pmid" || pid[i].classid == "re3data" + || pid[i].classid == "swhid") { if (!identifiers.has(pid[i].classid)) { identifiers.set(pid[i].classid, new Array()); } diff --git a/landingPages/landing-utils/showIdentifiers.component.ts b/landingPages/landing-utils/showIdentifiers.component.ts index e4644c34..8a0b4680 100644 --- a/landingPages/landing-utils/showIdentifiers.component.ts +++ b/landingPages/landing-utils/showIdentifiers.component.ts @@ -26,7 +26,7 @@ import {properties} from "../../../../environments/environment"; {{key}}: - {{item}} @@ -124,6 +124,8 @@ export class ShowIdentifiersComponent implements AfterViewInit { return properties.handleURL; } else if(key == "re3data") { return properties.r3DataURL; + } else if(key == "swhid") { + return properties.swhURL; } } diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 932901d7..9ba1309b 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -825,6 +825,8 @@ export class ResultLandingComponent { return this.properties.pmidURL + id.value; } else if (id.type === "handle") { return this.properties.handleURL + id.value; + } else if (id.type === "swhid") { + return this.properties.swhURL + id.value; } else { return null; } @@ -839,6 +841,8 @@ export class ResultLandingComponent { return 'PubMed'; } else if (id.type === "handle") { return 'Handle.NET'; + } else if(id.type == "swhid") { + return 'Software Heritage'; } else { return null; } diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 0ae3866f..30e1e76b 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -8,7 +8,7 @@ import { } from "../result-preview/result-preview"; export interface Id { - type: "pmid" | "doi" | "pmc" | "handle" | "openaire"; + type: "pmid" | "doi" | "pmc" | "handle" | "openaire" | "swhid"; value: string; trust: number } diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index af367504..4a2ccd68 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -44,6 +44,7 @@ export interface EnvProperties { cordisURL?: string; openDoarURL?: string; r3DataURL?: string; + swhURL?: string; fairSharingURL?: string, eoscMarketplaceURL?: string, sherpaURL?: string; diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index d05bc57e..dff363ff 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -149,7 +149,7 @@ export class DOI { } export class Identifier { - class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" = null; + class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" | "swhid" = null; id: string; public static getDOIsFromString(str: string): string[] { @@ -202,13 +202,15 @@ export class Identifier { return {"class": "handle", "id": pid}; } else if (Identifier.isValidRe3Data(pid)) { return {"class": "re3data", "id": pid}; + } else if (Identifier.isValidSwhId(pid)) { + return {"class": "swhid", "id": pid}; } //set it as a doi, to catch the case that doi has not valid format return (strict?null:{"class": "doi", "id": pid}); } public static getPIDFromIdentifiers(identifiers: Map): Identifier { - let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data"]; + let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data", "swhid"]; if(identifiers) { for (let cl of classes) { if (identifiers.get(cl)) { @@ -257,6 +259,12 @@ export class Identifier { let exp = /(r3d[1-9]\d{0,8})/g; return str.match(exp) != null; } + + public static isValidSwhId(str: string): boolean { + // let exp = /swh:1:(snp|rel|rev|dir|cnt):[0-9a-f]{40}/g; + let exp = /swh:1:snp:[0-9a-f]{40}/g; + return str.match(exp) != null; + } } export class StringUtils {