[ADF-2077] [Destination picker] User should not be able to copy / mo… (#2978)

* [ADF-20177] [Destination picker] User should not be able to copy / move items into a site outside of the documentLibrary

* [ADF-20177] added unit tests for the change

* [ADF-2077] refactor code and unit tests after code review

* [ADF-2077] more refactoring to make the unit tests messages more clear
This commit is contained in:
suzanadirla
2018-02-23 19:38:08 +02:00
committed by Eugenio Romano
parent 8f471d8beb
commit d997f14565
2 changed files with 89 additions and 7 deletions

View File

@@ -88,7 +88,7 @@ export class ContentNodeDialogService {
currentFolderId: contentEntry.parentId,
imageResolver: this.imageResolver.bind(this),
rowFilter : this.rowFilter.bind(this, contentEntry.id),
isSelectionValid: this.hasEntityCreatePermission.bind(this),
isSelectionValid: this.isCopyMoveSelectionValid.bind(this),
select: select
};
@@ -188,10 +188,18 @@ export class ContentNodeDialogService {
return entry.isFolder;
}
private isCopyMoveSelectionValid(entry: MinimalNodeEntryEntity): boolean {
return this.hasEntityCreatePermission(entry) && !this.isSite(entry);
}
private hasEntityCreatePermission(entry: MinimalNodeEntryEntity): boolean {
return this.contentService.hasPermission(entry, 'create');
}
private isSite(entry) {
return !!entry.guid || entry.nodeType === 'st:site' || entry.nodeType === 'st:sites';
}
/** Closes the currently open dialog. */
close() {
this.dialog.closeAll();