[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:
parent
e23421dc0f
commit
1b1e0170e1
|
@ -84,7 +84,7 @@ export class CommunityService {
|
|||
},
|
||||
error => {
|
||||
this.community.next(null);
|
||||
reject();
|
||||
resolve();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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 ||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -19,7 +19,7 @@ declare var UIkit;
|
|||
<div class="uk-grid uk-child-width-1-1" uk-grid [formGroup]="inviteForm">
|
||||
<div dashboard-input [formInput]="inviteForm.get('name')" [gridSmall]="true">
|
||||
<div class="uk-text-bold field-label">
|
||||
From *:
|
||||
From:
|
||||
</div>
|
||||
</div>
|
||||
<div dashboard-input [formInput]="inviteForm.get('recipients')" [gridSmall]="true" note="Separate multiple emails with a comma">
|
||||
|
|
Loading…
Reference in New Issue