Dataset and dmp overview fix.

* Fix edit issue when multiple users have ownership of the same dmp/dataset.

(cherry picked from commit fd9d35aad3)
This commit is contained in:
Kristian Ntavidi 2021-06-30 13:24:56 +03:00 committed by Diamantis Tziotzios
parent 04f230dff1
commit 82c5586067
2 changed files with 2 additions and 2 deletions

View File

@ -164,7 +164,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
setIsUserOwner() {
if (this.dataset) {
const principal: Principal = this.authentication.current();
if (principal) this.isUserOwner = principal.id === this.dataset.users.find(x => x.role === Role.Owner).id;
if (principal) this.isUserOwner = !!this.dataset.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
}
}

View File

@ -167,7 +167,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
setIsUserOwner() {
if (this.dmp) {
const principal: Principal = this.authentication.current();
if (principal) this.isUserOwner = principal.id === this.dmp.users.find(x => x.role === Role.Owner).id;
if (principal) this.isUserOwner = !!this.dmp.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
}
}