diff --git a/explore/src/app/app.component.ts b/explore/src/app/app.component.ts
index 3d552816..9368783f 100644
--- a/explore/src/app/app.component.ts
+++ b/explore/src/app/app.component.ts
@@ -1,13 +1,13 @@
-import {Component, Directive, ElementRef, Renderer2, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
-import {Observable} from 'rxjs';
+import {Component} from '@angular/core';
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
-import {Session} from './openaireLibrary/login/utils/helper.class';
+import {Session, User} from './openaireLibrary/login/utils/helper.class';
import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
+import {UserManagementService} from "./openaireLibrary/services/user-management.service";
@Component({
//changeDetection: ChangeDetectionStrategy.Default,
@@ -17,7 +17,7 @@ import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
`],
template: `
-
@@ -52,9 +52,11 @@ export class AppComponent {
feedbackmail: string;
properties: EnvProperties;
+ user: User;
+ loginCheck: boolean = false;
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
- private router: Router) {
+ private router: Router, private userManagementService: UserManagementService) {
router.events.forEach((event) => {
if (event instanceof NavigationStart) {
HelperFunctions.scroll();
@@ -77,8 +79,11 @@ export class AppComponent {
this.propertiesService.setEnvProperties(es);
this.properties = this.propertiesService.envSpecific;
this.feedbackmail = this.properties.feedbackmail;
- this.buildMenu();
-
+ this.userManagementService.getUserInfo(this.properties.userInfoUrl).subscribe(user => {
+ this.user = user;
+ this.loginCheck = true;
+ this.buildMenu();
+ });
//console.log(this.properties.loginUrl);
}, error => {
console.log("App couldn't fetch properties");
@@ -88,7 +93,6 @@ export class AppComponent {
}
buildMenu() {
-
this.menuItems = [
{
rootItem: new MenuItem("search", "Search", "", "/search/find", false, [], ["/search/find"], {}),
@@ -120,12 +124,12 @@ export class AppComponent {
new MenuItem("", "Browse all", "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], {})]
}
];
- if (Session.isPortalAdministrator()) {
+ if (Session.isPortalAdministrator(this.user)) {
this.userMenuItems.push(new MenuItem("", "Manage all links", "", "/claims", false, [], ["/claims"], {}));
this.userMenuItems.push(new MenuItem("", "Manage helptexts",
((this.properties.environment == "beta") ? "https://beta.admin.connect.openaire.eu" : "https://admin.explore.openaire.eu") + "/dashboard?communityId=openaire", "", true, [], [], {}))
- } else if (Session.isClaimsCurator()) {
+ } else if (Session.isClaimsCurator(this.user)) {
this.userMenuItems.push(new MenuItem("", "Manage all links", "", "/claims", false, [], ["/claims"], {}));
}
diff --git a/explore/src/app/claims/claimsAdmin/claimsAdmin.component.ts b/explore/src/app/claims/claimsAdmin/claimsAdmin.component.ts
index 8cba18f9..a56b2c25 100644
--- a/explore/src/app/claims/claimsAdmin/claimsAdmin.component.ts
+++ b/explore/src/app/claims/claimsAdmin/claimsAdmin.component.ts
@@ -7,7 +7,7 @@ import {EnvProperties} from '../../openaireLibrary/uti
@Component({
selector: 'openaire-claims-admin',
template: `
-
+
`,
@@ -16,6 +16,7 @@ import {EnvProperties} from '../../openaireLibrary/uti
export class OpenaireClaimsAdminComponent {
claimsInfoURL:string;
+ userInfoURL: string;
constructor (private route: ActivatedRoute) {
@@ -24,7 +25,7 @@ export class OpenaireClaimsAdminComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.claimsInfoURL = data.envSpecific.claimsInformationLink;
-
+ this.userInfoURL = data.envSpecific.userInfoUrl;
});
}
}
diff --git a/explore/src/app/claims/myClaims/myClaims.component.ts b/explore/src/app/claims/myClaims/myClaims.component.ts
index 429075d7..9cebe68e 100644
--- a/explore/src/app/claims/myClaims/myClaims.component.ts
+++ b/explore/src/app/claims/myClaims/myClaims.component.ts
@@ -8,13 +8,14 @@ import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properti
@Component({
selector: 'openaire-my-claims',
template: `
-
+
`
})
export class OpenaireMyClaimsComponent {
- claimsInfoURL:string;
+ claimsInfoURL:string;
+ userInfoURL: string;
constructor (private route: ActivatedRoute) {
@@ -23,7 +24,7 @@ import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properti
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.claimsInfoURL = data.envSpecific.claimsInformationLink;
-
+ this.userInfoURL = data.envSpecific.userInfoUrl;
});
}
}
diff --git a/explore/src/assets/env-properties.json b/explore/src/assets/env-properties.json
index 59ca0aec..39d2652d 100644
--- a/explore/src/assets/env-properties.json
+++ b/explore/src/assets/env-properties.json
@@ -34,6 +34,8 @@
"piwikSiteId" : "6",
"loginUrl" :"http://scoobydoo.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login",
+ "userInfoUrl" : "http://rudie.di.uoa.gr:8280/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=",
+
"logoutUrl" :"https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
"cookieDomain" :".di.uoa.gr",