[Library | Trunk]: 1. Fix user info id on parsing. 2. Add activeRoute field on MenuItem. 3. Finish inivte subscriber

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60284 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-01-22 18:09:44 +00:00
parent e23421dc0f
commit 1b1e0170e1
5 changed files with 18 additions and 5 deletions

View File

@ -84,7 +84,7 @@ export class CommunityService {
}, },
error => { error => {
this.community.next(null); this.community.next(null);
reject(); resolve();
}) })
}); });
} }

View File

@ -133,6 +133,17 @@ export class Session {
return false; 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 { public static isRegisteredUser(user: User): boolean {
return user && return user &&
(user.role.indexOf('urn:geant:openaire.eu:group:Registered+User#aai.openaire.eu') !== -1 || (user.role.indexOf('urn:geant:openaire.eu:group:Registered+User#aai.openaire.eu') !== -1 ||

View File

@ -81,7 +81,7 @@ export class UserManagementService{
private parseUserInfo(info: any) { private parseUserInfo(info: any) {
const user: User = new User(); 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.firstname = (info.given_name) ? info.given_name : "";
user.lastname = (info.family_name) ? info.family_name : ""; user.lastname = (info.family_name) ? info.family_name : "";
user.email = info.email.toLowerCase(); // TODO remove, is a quick fix user.email = info.email.toLowerCase(); // TODO remove, is a quick fix

View File

@ -3,6 +3,7 @@ export class MenuItem {
title: string = ""; title: string = "";
url: string = ""; // external url url: string = ""; // external url
route: string = ""; // internal url - using angular routing and components 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 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" 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 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; open: boolean;
customClass: string = null; 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.id = id;
this.title = title; this.title = title;
this.url = url; this.url = url;
this.route = route; this.route = route;
this.routeActive = routeActive;
this.needsAuthorization = needsAuthorization; this.needsAuthorization = needsAuthorization;
this.entitiesRequired = entitiesRequired; this.entitiesRequired = entitiesRequired;
this.routeRequired = routeRequired; this.routeRequired = routeRequired;
@ -38,7 +40,7 @@ export class MenuItem {
if (!menu.markAsActive) { if (!menu.markAsActive) {
return false; 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; return true;
} else if (menu.items.length > 0) { } else if (menu.items.length > 0) {
for (let menuItem of menu.items) { for (let menuItem of menu.items) {

View File

@ -19,7 +19,7 @@ declare var UIkit;
<div class="uk-grid uk-child-width-1-1" uk-grid [formGroup]="inviteForm"> <div class="uk-grid uk-child-width-1-1" uk-grid [formGroup]="inviteForm">
<div dashboard-input [formInput]="inviteForm.get('name')" [gridSmall]="true"> <div dashboard-input [formInput]="inviteForm.get('name')" [gridSmall]="true">
<div class="uk-text-bold field-label"> <div class="uk-text-bold field-label">
From *: From:
</div> </div>
</div> </div>
<div dashboard-input [formInput]="inviteForm.get('recipients')" [gridSmall]="true" note="Separate multiple emails with a comma"> <div dashboard-input [formInput]="inviteForm.get('recipients')" [gridSmall]="true" note="Separate multiple emails with a comma">