mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[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:
committed by
Denys Vuika
parent
48127a2421
commit
d3c6142d82
@@ -41,7 +41,8 @@ class TestNode {
|
|||||||
isFile?: boolean,
|
isFile?: boolean,
|
||||||
name?: string,
|
name?: string,
|
||||||
permission?: string[],
|
permission?: string[],
|
||||||
nodeType?: string
|
nodeType?: string,
|
||||||
|
properties?: any
|
||||||
) {
|
) {
|
||||||
this.entry = {};
|
this.entry = {};
|
||||||
this.entry.id = id || 'node-id';
|
this.entry.id = id || 'node-id';
|
||||||
@@ -52,6 +53,9 @@ class TestNode {
|
|||||||
if (permission) {
|
if (permission) {
|
||||||
this.entry['allowableOperations'] = permission;
|
this.entry['allowableOperations'] = permission;
|
||||||
}
|
}
|
||||||
|
if (properties) {
|
||||||
|
this.entry.properties = properties;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,6 +309,22 @@ describe('NodeActionsService', () => {
|
|||||||
})
|
})
|
||||||
).toBe(true);
|
).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', () => {
|
describe('copyNodes', () => {
|
||||||
|
|||||||
@@ -52,6 +52,14 @@ import { catchError, map, mergeMap } from 'rxjs/operators';
|
|||||||
export class NodeActionsService {
|
export class NodeActionsService {
|
||||||
static SNACK_MESSAGE_DURATION_WITH_UNDO = 10000;
|
static SNACK_MESSAGE_DURATION_WITH_UNDO = 10000;
|
||||||
static SNACK_MESSAGE_DURATION = 3000;
|
static SNACK_MESSAGE_DURATION = 3000;
|
||||||
|
static restrictedSiteContent = [
|
||||||
|
'blog',
|
||||||
|
'calendar',
|
||||||
|
'dataLists',
|
||||||
|
'discussions',
|
||||||
|
'links',
|
||||||
|
'wiki'
|
||||||
|
];
|
||||||
|
|
||||||
contentCopied: Subject<MinimalNodeEntity[]> = new Subject<
|
contentCopied: Subject<MinimalNodeEntity[]> = new Subject<
|
||||||
MinimalNodeEntity[]
|
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() {
|
close() {
|
||||||
this.dialog.closeAll();
|
this.dialog.closeAll();
|
||||||
}
|
}
|
||||||
@@ -636,7 +655,11 @@ export class NodeActionsService {
|
|||||||
const node: MinimalNodeEntryEntity = row.node.entry;
|
const node: MinimalNodeEntryEntity = row.node.entry;
|
||||||
|
|
||||||
this.isSitesDestinationAvailable = !!node['guid'];
|
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
|
// todo: review once 1.10-beta6 is out
|
||||||
|
|||||||
Reference in New Issue
Block a user