[ACA-1322] Destination picker - Sites: only document library allowed as destination (#841)

* [ACA-1322] hide restricted site content

* [ACA-1322] unit test
This commit is contained in:
Suzana Dirla
2018-11-29 16:15:13 +00:00
committed by Denys Vuika
parent 48127a2421
commit d3c6142d82
2 changed files with 45 additions and 2 deletions
+21 -1
View File
@@ -41,7 +41,8 @@ class TestNode {
isFile?: boolean,
name?: string,
permission?: string[],
nodeType?: string
nodeType?: string,
properties?: any
) {
this.entry = {};
this.entry.id = id || 'node-id';
@@ -52,6 +53,9 @@ class TestNode {
if (permission) {
this.entry['allowableOperations'] = permission;
}
if (properties) {
this.entry.properties = properties;
}
}
}
@@ -305,6 +309,22 @@ describe('NodeActionsService', () => {
})
).toBe(true);
});
it('should filter destination nodes and not show the restricted site content', () => {
const restrictedSiteContent = new TestNode(
'blog-id',
!isFile,
'blog',
[],
'cm:folder',
{ 'st:componentId': 'blog' }
);
expect(
testContentNodeSelectorComponentData.data.rowFilter({
node: restrictedSiteContent
})
).toBe(false);
});
});
describe('copyNodes', () => {
+24 -1
View File
@@ -52,6 +52,14 @@ import { catchError, map, mergeMap } from 'rxjs/operators';
export class NodeActionsService {
static SNACK_MESSAGE_DURATION_WITH_UNDO = 10000;
static SNACK_MESSAGE_DURATION = 3000;
static restrictedSiteContent = [
'blog',
'calendar',
'dataLists',
'discussions',
'links',
'wiki'
];
contentCopied: Subject<MinimalNodeEntity[]> = new Subject<
MinimalNodeEntity[]
@@ -289,6 +297,17 @@ export class NodeActionsService {
);
}
private isRestrictedSiteContent(entry) {
if (entry && entry.properties && entry.properties['st:componentId']) {
const restrictedItem = NodeActionsService.restrictedSiteContent.find(
restrictedId => entry.properties['st:componentId'] === restrictedId
);
return !!restrictedItem;
}
return false;
}
close() {
this.dialog.closeAll();
}
@@ -636,7 +655,11 @@ export class NodeActionsService {
const node: MinimalNodeEntryEntity = row.node.entry;
this.isSitesDestinationAvailable = !!node['guid'];
return !node.isFile && node.nodeType !== 'app:folderlink';
return (
!node.isFile &&
node.nodeType !== 'app:folderlink' &&
!this.isRestrictedSiteContent(node)
);
}
// todo: review once 1.10-beta6 is out