diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-07-15 17:29:17 +0530 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-07-15 17:29:17 +0530 |
commit | e468d507c69b9149c0e972ebad3745e4a046ddf0 (patch) | |
tree | 973d87c37432ab62a4ab707b90a8e5915ac1bb39 /src/fields/util.ts | |
parent | 5c6d76f1c7836d8e9f43707384ee2daa74f1565f (diff) | |
parent | db15b1d27a639af7a65f72dd5e4b6ea298412315 (diff) |
Merge branch 'acls_uv' of https://github.com/browngraphicslab/Dash-Web into acls_uv
Diffstat (limited to 'src/fields/util.ts')
-rw-r--r-- | src/fields/util.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts index 006129730..ea4966861 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -70,8 +70,8 @@ const _setterImpl = action(function (target: any, prop: string | symbol | number const writeMode = DocServer.getFieldWriteMode(prop as string); const fromServer = target[UpdatingFromServer]; const sameAuthor = fromServer || (receiver.author === Doc.CurrentUserEmail); - const writeToDoc = sameAuthor || (writeMode !== DocServer.WriteMode.LiveReadonly); - const writeToServer = (sameAuthor || (writeMode === DocServer.WriteMode.Default)) && !playgroundMode; + const writeToDoc = sameAuthor || GetEffectiveAcl(target) === AclEdit || (writeMode !== DocServer.WriteMode.LiveReadonly); + const writeToServer = (sameAuthor || GetEffectiveAcl(target) === AclEdit || writeMode === DocServer.WriteMode.Default) && !playgroundMode; if (writeToDoc) { if (value === undefined) { @@ -91,8 +91,9 @@ const _setterImpl = action(function (target: any, prop: string | symbol | number redo: () => receiver[prop] = value, undo: () => receiver[prop] = curValue }); + return true; } - return true; + return false; }); let _setter: (target: any, prop: string | symbol | number, value: any, receiver: any) => boolean = _setterImpl; @@ -126,6 +127,7 @@ export function setGroups(groups: string[]) { } export function GetEffectiveAcl(target: any, in_prop?: string | symbol | number): symbol { + if (in_prop === UpdatingFromServer || target[UpdatingFromServer]) return AclEdit; const HierarchyMapping = new Map<symbol, number>([ [AclPrivate, 0], |