diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-08-10 18:07:51 +0530 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-08-10 18:07:51 +0530 |
commit | f557c78db9a77812ab398aaff08d9511c1c65fc9 (patch) | |
tree | 69092d21cf97d36842e7eca932e0e19d43447f76 /src/fields/util.ts | |
parent | 3dab659503e98fe75a9c0671057771ff666d7e10 (diff) |
prevented infinite loop in distributeAcls + allowed change of alias x, y, width, height in owned collection + changes to removeDocument calls in many places + comments etc
Diffstat (limited to 'src/fields/util.ts')
-rw-r--r-- | src/fields/util.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts index 4c71572db..7d3268b80 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -167,6 +167,9 @@ export function GetEffectiveAcl(target: any, in_prop?: string | symbol | number) // if the ACL is being overriden or the property being modified is one of the playground fields (which can be freely modified) if (_overrideAcl || (in_prop && DocServer.PlaygroundFields?.includes(in_prop.toString()))) return AclEdit; + // if it's your alias then you can manipulate the x, y, width, height + if ((target.aliasOf || target.__fields?.aliasOf) && Doc.CurrentUserEmail === (target.__fields?.author || target.author) && (in_prop && ["_width", "_height", "x", "y"].includes(in_prop.toString()))) return AclEdit; + let effectiveAcl = AclPrivate; const HierarchyMapping = new Map<symbol, number>([ [AclPrivate, 0], @@ -218,9 +221,10 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc changed = true; // maps over the aliases of the document - if (target.aliases) { - DocListCast(target.aliases).map(alias => { - distributeAcls(key, acl, alias, inheritingFromCollection); + const aliases = DocListCast(target.aliases); + if (aliases.length) { + aliases.map(alias => { + alias !== target && distributeAcls(key, acl, alias, inheritingFromCollection); }); } |