[Library | Trunk]: User Component: getRolesFomratted base only on new roles

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60461 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-02-19 18:18:53 +00:00
parent 6e34d05a1d
commit 5ee9ca6803
1 changed files with 5 additions and 13 deletions

View File

@ -123,20 +123,12 @@ export class UserComponent {
getTheRolesFormatted(roles: string[]) {
let formattedRoles = [];
for (let role of roles) {
if(role.includes("urn:geant:openaire.eu:group:")) {
let formattedRole = role.split("urn:geant:openaire.eu:group:")[1];
formattedRole = formattedRole.split("#aai.openaire.eu")[0]
formattedRole = formattedRole.replace("+", " ");
formattedRole = formattedRole.split("+").join(" ");
formattedRoles.push(formattedRole);
if(role.indexOf("_MANAGER")!=-1){
formattedRoles.push("Manager of " + role.split("_")[1]);
}else if((["FUNDER","COMMUNITY","INSTITUTION","PROJECT"]).indexOf(role.split("_")[0])!=-1){
formattedRoles.push("Member of " + role.split("_")[1]);
}else{
if(role.indexOf("_MANAGER")!=-1){
formattedRoles.push("Manager of " + role.split("_")[1]);
}else if((["FUNDER","COMMUNITY","INSTITUTION","PROJECT"]).indexOf(role.split("_")[0])!=-1){
formattedRoles.push("Member of " + role.split("_")[1]);
}else{
formattedRoles.splice(0,0,StringUtils.capitalize(role.split('_').join(' ').toLowerCase()));
}
formattedRoles.splice(0,0,StringUtils.capitalize(role.split('_').join(' ').toLowerCase()));
}
}
return formattedRoles.join(", ");