diff --git a/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts b/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts index fda3c1818..dcef445ee 100644 --- a/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts +++ b/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts @@ -77,14 +77,11 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes } getUserRole(dmp: DmpModel) { - let role = -1; - dmp.users.forEach(user => { - if (user.id === this.currentUserId) { - role = user.role; - } - }); - if (role === 0) { return this.language.instant('USER-PROFILE.DMPS.CREATOR'); } else if (role === 1) { return this.language.instant('USER-PROFILE.DMPS.MEMBER'); } - return ''; + if (dmp.creator.id === this.currentUserId) { + return this.language.instant('USER-PROFILE.DMPS.CREATOR'); + } else if (dmp.associatedUsers.map(x => x.id).indexOf(this.currentUserId) !== -1) { + return this.language.instant('USER-PROFILE.DMPS.MEMBER'); + } } showAllDmps() {