aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentView.tsx
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-16 00:23:42 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-16 00:23:42 -0500
commit5a1a8b2c19bda271e6471e457fad59094c5c0449 (patch)
tree7fbec72a4dd9aa1a4d5e3d06e32470b5b1c44147 /src/client/views/nodes/DocumentView.tsx
parente2c60eaad49da3d0485b6f5f236fb0aabb84bef0 (diff)
parentaee958a85c61927970e55ede004c91a0251a9405 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into anika_schema_view
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r--src/client/views/nodes/DocumentView.tsx21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 35bf5344e..d1877c3a0 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -687,13 +687,30 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
@undoBatch
@action
setAcl = (acl: "readOnly" | "addOnly" | "ownerOnly") => {
- this.layoutDoc.ACL = this.dataDoc.ACL = acl;
+ this.dataDoc.ACL = this.props.Document.ACL = acl;
DocListCast(this.dataDoc[Doc.LayoutFieldKey(this.dataDoc)]).map(d => {
if (d.author === Doc.CurrentUserEmail) d.ACL = acl;
const data = d[DataSym];
if (data && data.author === Doc.CurrentUserEmail) data.ACL = acl;
});
}
+ @undoBatch
+ @action
+ testAcl = (acl: "readOnly" | "addOnly" | "ownerOnly") => {
+ this.dataDoc.author = this.props.Document.author = "ADMIN";
+ this.dataDoc.ACL = this.props.Document.ACL = acl;
+ DocListCast(this.dataDoc[Doc.LayoutFieldKey(this.dataDoc)]).map(d => {
+ if (d.author === Doc.CurrentUserEmail) {
+ d.author = "ADMIN";
+ d.ACL = acl;
+ }
+ const data = d[DataSym];
+ if (data && data.author === Doc.CurrentUserEmail) {
+ data.author = "ADMIN";
+ data.ACL = acl;
+ }
+ });
+ }
@action
onContextMenu = async (e: React.MouseEvent | Touch): Promise<void> => {
@@ -758,6 +775,8 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
moreItems.push({ description: "Make Add Only", event: () => this.setAcl("addOnly"), icon: "concierge-bell" });
moreItems.push({ description: "Make Read Only", event: () => this.setAcl("readOnly"), icon: "concierge-bell" });
moreItems.push({ description: "Make Private", event: () => this.setAcl("ownerOnly"), icon: "concierge-bell" });
+ moreItems.push({ description: "Test Private", event: () => this.testAcl("ownerOnly"), icon: "concierge-bell" });
+ moreItems.push({ description: "Test Readonly", event: () => this.testAcl("readOnly"), icon: "concierge-bell" });
moreItems.push({ description: "Make View of Metadata Field", event: () => Doc.MakeMetadataFieldTemplate(this.props.Document, this.props.DataDoc), icon: "concierge-bell" });
moreItems.push({ description: `${this.Document._chromeStatus !== "disabled" ? "Hide" : "Show"} Chrome`, event: () => this.Document._chromeStatus = (this.Document._chromeStatus !== "disabled" ? "disabled" : "enabled"), icon: "project-diagram" });
moreItems.push({ description: this.Document.lockedPosition ? "Unlock Position" : "Lock Position", event: this.toggleLockPosition, icon: BoolCast(this.Document.lockedPosition) ? "unlock" : "lock" });