diff --git a/connect/community/community.service.ts b/connect/community/community.service.ts index 44a1b0f3..348d1e90 100644 --- a/connect/community/community.service.ts +++ b/connect/community/community.service.ts @@ -84,7 +84,7 @@ export class CommunityService { }, error => { this.community.next(null); - reject(); + resolve(); }) }); } diff --git a/login/utils/helper.class.ts b/login/utils/helper.class.ts index 66c7047d..45377ed9 100644 --- a/login/utils/helper.class.ts +++ b/login/utils/helper.class.ts @@ -133,6 +133,17 @@ export class Session { return false; } + public static isKindOfCommunityManager(user: User): boolean { + if (user) { + for (let role of user.role) { + if (role.indexOf('COMMUNITY') !== -1 && role.indexOf('_MANAGER') !== -1) { + return true; + } + } + } + return false; + } + public static isRegisteredUser(user: User): boolean { return user && (user.role.indexOf('urn:geant:openaire.eu:group:Registered+User#aai.openaire.eu') !== -1 || diff --git a/services/user-management.service.ts b/services/user-management.service.ts index 310be3f6..cd310486 100644 --- a/services/user-management.service.ts +++ b/services/user-management.service.ts @@ -81,7 +81,7 @@ export class UserManagementService{ private parseUserInfo(info: any) { const user: User = new User(); - user.id = (info.subscriptions && info.subscriptions.indexOf('@')) ? info.subscriptions.substring(0, info.subscriptions.indexOf('@')) : info.subscriptions; + user.id = (info.sub && info.sub.indexOf('@')) ? info.sub.substring(0, info.sub.indexOf('@')) : info.sub; user.firstname = (info.given_name) ? info.given_name : ""; user.lastname = (info.family_name) ? info.family_name : ""; user.email = info.email.toLowerCase(); // TODO remove, is a quick fix diff --git a/sharedComponents/menu.ts b/sharedComponents/menu.ts index bef27701..748c7820 100644 --- a/sharedComponents/menu.ts +++ b/sharedComponents/menu.ts @@ -3,6 +3,7 @@ export class MenuItem { title: string = ""; url: string = ""; // external url route: string = ""; // internal url - using angular routing and components + routeActive: string = ""; // route to check if it is active needsAuthorization: boolean = false; // needs admin rights - mainly for user menu at this point entitiesRequired: string[] = []; // openaire entities used in page "publication, dataset, organization, software, project, datasource" routeRequired: string[] = []; // the routes that if aren't enable the menu item doesn't make sense @@ -14,11 +15,12 @@ export class MenuItem { open: boolean; customClass: string = null; - constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params, icon=null, fragment = null, customClass = null) { + constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params, icon=null, fragment = null, customClass = null, routeActive = null) { this.id = id; this.title = title; this.url = url; this.route = route; + this.routeActive = routeActive; this.needsAuthorization = needsAuthorization; this.entitiesRequired = entitiesRequired; this.routeRequired = routeRequired; @@ -38,7 +40,7 @@ export class MenuItem { if (!menu.markAsActive) { return false; } - if (menu.route.length > 0 && (currentRoute == menu.route)) { + if (menu.route.length > 0 && ((menu.routeActive && currentRoute.includes(menu.routeActive)) || currentRoute == menu.route)) { return true; } else if (menu.items.length > 0) { for (let menuItem of menu.items) { diff --git a/sharedComponents/subscriber-invite/subscriber-invite.component.ts b/sharedComponents/subscriber-invite/subscriber-invite.component.ts index 625139cf..a2a20f3d 100644 --- a/sharedComponents/subscriber-invite/subscriber-invite.component.ts +++ b/sharedComponents/subscriber-invite/subscriber-invite.component.ts @@ -19,7 +19,7 @@ declare var UIkit;
- From *: + From: