#8149 - [Bug fix] Updated condition to check if current user is owner of DMP/ Dataset (drafts.component.ts & recent-edited-activity.component.ts & recent-edited-dataset-activity.component.ts & recent-edited-dmp-activity.component.ts & dataset-listing-item.component.ts & dmp-clone.component.ts & dmp-listing-item.component.ts).
This commit is contained in:
parent
20f618a5d7
commit
4dd338d08e
|
@ -227,7 +227,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
isUserOwner(activity: DatasetListingModel): boolean {
|
isUserOwner(activity: DatasetListingModel): boolean {
|
||||||
const principal: Principal = this.authentication.current();
|
const principal: Principal = this.authentication.current();
|
||||||
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
|
if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
onCallbackSuccess(id?: String): void {
|
onCallbackSuccess(id?: String): void {
|
||||||
|
|
|
@ -186,7 +186,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
||||||
|
|
||||||
isUserOwner(activity: DmpListingModel): boolean {
|
isUserOwner(activity: DmpListingModel): boolean {
|
||||||
const principal: Principal = this.authentication.current();
|
const principal: Principal = this.authentication.current();
|
||||||
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
|
if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
editClicked(dmp: DmpListingModel) {
|
editClicked(dmp: DmpListingModel) {
|
||||||
|
|
|
@ -163,7 +163,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
|
||||||
|
|
||||||
isUserOwner(activity: DatasetListingModel): boolean {
|
isUserOwner(activity: DatasetListingModel): boolean {
|
||||||
const principal: Principal = this.authentication.current();
|
const principal: Principal = this.authentication.current();
|
||||||
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
|
if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
goToOverview(id: string): string[] {
|
goToOverview(id: string): string[] {
|
||||||
|
|
|
@ -165,7 +165,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
|
||||||
|
|
||||||
isUserOwner(activity: DmpListingModel): boolean {
|
isUserOwner(activity: DmpListingModel): boolean {
|
||||||
const principal: Principal = this.authentication.current();
|
const principal: Principal = this.authentication.current();
|
||||||
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
|
if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
editClicked(dmp: DmpListingModel) {
|
editClicked(dmp: DmpListingModel) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
|
||||||
setIsUserOwner() {
|
setIsUserOwner() {
|
||||||
if (this.dataset) {
|
if (this.dataset) {
|
||||||
const principal: Principal = this.authentication.current();
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,11 @@ export class DmpCloneComponent extends BaseComponent implements OnInit {
|
||||||
setIsUserOwner() {
|
setIsUserOwner() {
|
||||||
if (this.dmp) {
|
if (this.dmp) {
|
||||||
const principal: Principal = this.authentication.current();
|
const principal: Principal = this.authentication.current();
|
||||||
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));
|
||||||
|
} else {
|
||||||
|
this.isUserOwner = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -367,6 +367,6 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
isUserOwner(activity: DmpListingModel): boolean {
|
isUserOwner(activity: DmpListingModel): boolean {
|
||||||
const principal: Principal = this.authentication.current();
|
const principal: Principal = this.authentication.current();
|
||||||
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
|
if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue