aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-10-06 12:15:49 -0400
committerbobzel <zzzman@gmail.com>2020-10-06 12:15:49 -0400
commit68916ee8daafb03ad2aff3338e18ca419ce888de (patch)
tree061672e28731aeffa87fa76fb6d3af59c43e0865 /src/client/views/collections/CollectionView.tsx
parent83aaea5320257ce15d68a5299c00977684ddab8e (diff)
fixed adding documents to check acl of added document(s) correctly
Diffstat (limited to 'src/client/views/collections/CollectionView.tsx')
-rw-r--r--src/client/views/collections/CollectionView.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 2bdc8e2f3..0ef3dd6cd 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -157,7 +157,7 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
});
}
else {
- added.map(doc => {
+ added.filter(doc => [AclAdmin, AclEdit].includes(GetEffectiveAcl(doc))).map(doc => { // only make a pushpin if we have acl's to edit the document
const context = Cast(doc.context, Doc, null);
if (context && (context.type === DocumentType.VID || context.type === DocumentType.WEB || context.type === DocumentType.PDF || context.type === DocumentType.IMG)) {
const pushpin = Docs.Create.FontIconDocument({
@@ -186,9 +186,9 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
@action.bound
removeDocument = (doc: any): boolean => {
const effectiveAcl = GetEffectiveAcl(this.props.Document[DataSym]);
- const docAcl = GetEffectiveAcl(doc);
- if (effectiveAcl === AclEdit || effectiveAcl === AclAdmin || docAcl === AclAdmin) {
- const docs = doc instanceof Doc ? [doc] : doc as Doc[];
+ const indocs = doc instanceof Doc ? [doc] : doc as Doc[];
+ const docs = indocs.filter(doc => effectiveAcl === AclEdit || effectiveAcl === AclAdmin || GetEffectiveAcl(doc) === AclAdmin);
+ if (docs.length) {
const targetDataDoc = this.props.Document[DataSym];
const value = DocListCast(targetDataDoc[this.props.fieldKey]);
const toRemove = value.filter(v => docs.includes(v));