aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Doc.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-06-04 20:03:47 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-06-04 20:03:47 +0530
commit411a18999fe8e8bd2929d42d10e60df043a29475 (patch)
tree16929bb859b994ca85353807cfbd545cba05c7ba /src/fields/Doc.ts
parent78f70dbd2136aa8b7b05bacafc71a8a714462d29 (diff)
parentdaf6862f0ce890e56a53afaab099c5e69c692c08 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into grid_view_secondary
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r--src/fields/Doc.ts25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index 6891bf652..e46acd16d 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -94,7 +94,7 @@ export const HeightSym = Symbol("Height");
export const DataSym = Symbol("Data");
export const LayoutSym = Symbol("Layout");
export const AclSym = Symbol("Acl");
-export const AclPrivate = Symbol("AclNoAccess");
+export const AclPrivate = Symbol("AclOwnerOnly");
export const AclReadonly = Symbol("AclReadOnly");
export const AclAddonly = Symbol("AclAddonly");
export const UpdatingFromServer = Symbol("UpdatingFromServer");
@@ -103,13 +103,17 @@ const CachedUpdates = Symbol("Cached updates");
function fetchProto(doc: Doc) {
if (doc.author !== Doc.CurrentUserEmail) {
- if (doc.ACL === "noAccess") {
- doc[AclSym] = AclPrivate;
- return undefined;
- } else if (doc.ACL === "readOnly") {
- doc[AclSym] = AclReadonly;
- } else if (doc.ACL === "addOnly") {
- doc[AclSym] = AclAddonly;
+ const acl = Doc.Get(doc, "ACL", true);
+ switch (acl) {
+ case "ownerOnly":
+ doc[AclSym] = AclPrivate;
+ return undefined;
+ case "readOnly":
+ doc[AclSym] = AclReadonly;
+ break;
+ case "addOnly":
+ doc[AclSym] = AclAddonly;
+ break;
}
}
@@ -117,7 +121,7 @@ function fetchProto(doc: Doc) {
if (proto instanceof Promise) {
proto.then(proto => {
if (proto.author !== Doc.CurrentUserEmail) {
- if (proto.ACL === "noAccess") {
+ if (proto.ACL === "ownerOnly") {
proto[AclSym] = doc[AclSym] = AclPrivate;
return undefined;
} else if (proto.ACL === "readOnly") {
@@ -484,6 +488,7 @@ export namespace Doc {
}
alias.aliasOf = doc;
alias.title = ComputedField.MakeFunction(`renameAlias(this, ${Doc.GetProto(doc).aliasNumber = NumCast(Doc.GetProto(doc).aliasNumber) + 1})`);
+ alias.author = Doc.CurrentUserEmail;
return alias;
}
@@ -614,7 +619,7 @@ export namespace Doc {
}
}
});
-
+ copy["author"] = Doc.CurrentUserEmail;
return copy;
}