From 64eebccc47043f6253dbeffb053e2a81cd277027 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Wed, 12 Jun 2019 11:50:48 +0000 Subject: [PATCH] [Library|Trunk] User info: add user information when user is logged in and there is no error or redirect parameters Add spaces lost after ang 7 migration (funded by component, orcid dropdown, search results labels) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56056 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../landing-utils/fundedBy.component.ts | 2 +- login/user.component.html | 110 ++++++++++-------- login/user.component.ts | 20 +++- login/utils/helper.class.ts | 14 +++ .../searchUtils/searchResult.component.html | 6 +- utils/authors/showAuthors.component.ts | 4 +- 6 files changed, 101 insertions(+), 55 deletions(-) diff --git a/landingPages/landing-utils/fundedBy.component.ts b/landingPages/landing-utils/fundedBy.component.ts index 73c0f521..f470b50b 100644 --- a/landingPages/landing-utils/fundedBy.component.ts +++ b/landingPages/landing-utils/fundedBy.component.ts @@ -42,7 +42,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class"; - + {{" "}} diff --git a/login/user.component.html b/login/user.component.html index e978ea53..b63dc0f9 100644 --- a/login/user.component.html +++ b/login/user.component.html @@ -1,58 +1,76 @@ - -
+
-
+
-
+
-
-
- Hello {{user.fullname}}! -
- -
- +
+ -
- The requested page requires authentication. - - Please sign in to continue. +

This service uses the same ldap sign-in as the OpenAIRE services so you can use the same + credentials.

+ +

Login in. To see it in action.

+
+ +
+ +
+ +
+
+ +
+ +
+ The requested page requires authentication. + + Please sign in to continue. -
-
- You are not authorized to use the requested page. -
-
- The session has expired. Please sign in again or continue browsing as a guest. -
-
- You are not authorized to use the requested page. -
-
- There is no research community selected. -
+
+
+ You are not authorized to use the requested page. +
+
+ The session has expired. Please sign in again or continue browsing as a guest. +
+
+ You are not authorized to use the requested page. +
+
+ There is no research community selected. +
-
{{errorMessage}}
+
{{errorMessage}}
-
-
-
+
+
+
diff --git a/login/user.component.ts b/login/user.component.ts index 3f3dc3e1..efb21421 100644 --- a/login/user.component.ts +++ b/login/user.component.ts @@ -88,9 +88,10 @@ export class UserComponent { }else{ this.router.navigate([baseUrl]); } - }else{ - this.router.navigate(['/']); } + // else{ + // this.router.navigate(['/']); + // } } logIn(){ @@ -112,6 +113,19 @@ export class UserComponent { window.location.href = this.properties.loginUrl; } - + getTheRolesFormatted(roles:string[]){ + let formattedRoles = []; + for(let role of roles ){ + 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); + } + return formattedRoles.join(", "); + } + isUSerManager(){ + return Session.isUserManager(); + } } diff --git a/login/utils/helper.class.ts b/login/utils/helper.class.ts index c5afc208..9d978fc0 100644 --- a/login/utils/helper.class.ts +++ b/login/utils/helper.class.ts @@ -168,6 +168,20 @@ export class Session{ } return isAuthorized; } + public static isUserManager():boolean { + var isAuthorized = false; + if(Session.isLoggedIn()){ + var roles = ["urn:geant:openaire.eu:group:User+Manager#aai.openaire.eu"]; + for (var i = 0; i < roles.length; i++) { + if ((Session.getUser().role).indexOf(roles[i]) > -1) { + isAuthorized = true; + break; + } + } + return isAuthorized; + } + return isAuthorized; + } public static isRegisteredUser():boolean { var isAuthorized = false; if(Session.isLoggedIn()){ diff --git a/searchPages/searchUtils/searchResult.component.html b/searchPages/searchUtils/searchResult.component.html index c88bc573..e0c87184 100644 --- a/searchPages/searchUtils/searchResult.component.html +++ b/searchPages/searchUtils/searchResult.component.html @@ -39,9 +39,9 @@
Publisher: {{result.publisher}}
- {{result['type']}} - {{result.compatibility}} - {{result.country}} + {{result['type']}}{{' '}} + {{result.compatibility}}{{' '}} + {{result.country}}{{' '}}
Project: diff --git a/utils/authors/showAuthors.component.ts b/utils/authors/showAuthors.component.ts index 06403cef..9d15ac25 100644 --- a/utils/authors/showAuthors.component.ts +++ b/utils/authors/showAuthors.component.ts @@ -21,12 +21,12 @@ import {EnvProperties} from '../properties/env-properties';
ORCID
- {{author.orcid}} + {{author.orcid}}{{" "}} + {{" "}} Visit