From c0f57178d79ec405a855bac82d6a12b6ae0dea27 Mon Sep 17 00:00:00 2001
From: Bob Zeleznik <zzzman@gmail.com>
Date: Fri, 12 Jun 2020 20:53:57 -0400
Subject: added ACL's for annotations.

---
 src/client/views/DocComponent.tsx | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'src/client/views/DocComponent.tsx')

diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index 3af570f1e..9b9a28f0f 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -1,4 +1,4 @@
-import { Doc, Opt, DataSym, DocListCast } from '../../fields/Doc';
+import { Doc, Opt, DataSym, DocListCast, AclSym, AclReadonly, AclAddonly } from '../../fields/Doc';
 import { Touchable } from './Touchable';
 import { computed, action, observable } from 'mobx';
 import { Cast, BoolCast, ScriptCast } from '../../fields/Types';
@@ -138,9 +138,15 @@ export function ViewBoxAnnotatableComponent<P extends ViewBoxAnnotatableProps, T
             const docList = DocListCast(targetDataDoc[this.annotationKey]);
             const added = docs.filter(d => !docList.includes(d));
             if (added.length) {
-                added.map(doc => doc.context = this.props.Document);
-                targetDataDoc[this.annotationKey] = new List<Doc>([...docList, ...added]);
-                targetDataDoc[this.annotationKey + "-lastModified"] = new DateField(new Date(Date.now()));
+                if (this.dataDoc[AclSym] === AclReadonly) {
+                    return false;
+                } else if (this.dataDoc[AclSym] === AclAddonly) {
+                    added.map(doc => Doc.AddDocToList(targetDataDoc, this.annotationKey, doc));
+                } else {
+                    added.map(doc => doc.context = this.props.Document);
+                    targetDataDoc[this.annotationKey] = new List<Doc>([...docList, ...added]);
+                    targetDataDoc[this.annotationKey + "-lastModified"] = new DateField(new Date(Date.now()));
+                }
             }
             return true;
         }
-- 
cgit v1.2.3-70-g09d2

