[Library | Trunk]: Add boolean communityMap on mapType

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60301 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-01-27 13:52:15 +00:00
parent d8fca31d81
commit b024bce255
2 changed files with 4 additions and 4 deletions

View File

@ -124,7 +124,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
this.createRoleModal.okButtonLeft = false;
this.createRoleModal.okButtonText = 'create';
this.roleFb = this.fb.group({
name: this.fb.control(Session.mapType(this.type) + '.' + this.id, Validators.required),
name: this.fb.control(Session.mapType(this.type, (this.role === 'manager')) + '.' + this.id, Validators.required),
description: this.fb.control('', Validators.required)
});
setTimeout(() => {

View File

@ -115,7 +115,7 @@ export class Session {
}
public static isMember(type: string, id: string, user: User): boolean {
return user && user.role.indexOf(this.mapType(type).toUpperCase() + '_' + id.toUpperCase()) !== -1;
return user && user.role.indexOf(this.mapType(type, false).toUpperCase() + '_' + id.toUpperCase()) !== -1;
}
public static isManager(type: string, id: string, user: User): boolean {
@ -150,8 +150,8 @@ export class Session {
user.role.indexOf('REGISTERED_USER') !== -1);
}
public static mapType(type: string): string {
if (type == "ri") {
public static mapType(type: string, communityMap: boolean = true): string {
if (type == "ri" && communityMap) {
type = "community";
} else if (type == "organization") {
type = "institution";