Project

General

Profile

« Previous | Next » 

Revision 60301

[Library | Trunk]: Add boolean communityMap on mapType

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/users/role-users/role-users.component.ts
124 124
    this.createRoleModal.okButtonLeft = false;
125 125
    this.createRoleModal.okButtonText = 'create';
126 126
    this.roleFb = this.fb.group({
127
      name: this.fb.control(Session.mapType(this.type) + '.' + this.id, Validators.required),
127
      name: this.fb.control(Session.mapType(this.type, (this.role === 'manager')) + '.' + this.id, Validators.required),
128 128
      description: this.fb.control('', Validators.required)
129 129
    });
130 130
    setTimeout(() => {
modules/uoa-services-library/trunk/ng-openaire-library/src/app/login/utils/helper.class.ts
115 115
  }
116 116
  
117 117
  public static isMember(type: string, id: string, user: User): boolean {
118
    return user && user.role.indexOf(this.mapType(type).toUpperCase() + '_' + id.toUpperCase()) !== -1;
118
    return user && user.role.indexOf(this.mapType(type, false).toUpperCase() + '_' + id.toUpperCase()) !== -1;
119 119
  }
120 120
  
121 121
  public static isManager(type: string, id: string, user: User): boolean {
......
150 150
        user.role.indexOf('REGISTERED_USER') !== -1);
151 151
  }
152 152
  
153
  public static mapType(type: string): string {
154
    if (type == "ri") {
153
  public static mapType(type: string, communityMap: boolean = true): string {
154
    if (type == "ri" && communityMap) {
155 155
      type = "community";
156 156
    } else if (type == "organization") {
157 157
      type = "institution";

Also available in: Unified diff