diff options
-rw-r--r-- | src/fields/util.ts | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts index 17eb47222..cc29c7df9 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -128,13 +128,13 @@ export function denormalizeEmail(email: string) { * Copies parent's acl fields to the child */ export function inheritParentAcls(parent: Doc, child: Doc) { - for (const key of Object.keys(parent)) { + for (const key of Object.keys(Doc.GetProto(parent))) { // if the default acl mode is private, then don't inherit the acl-Public permission, but set it to private. - // const permission: string = key === 'acl-Public' && Doc.defaultAclPrivate ? AclPrivate : parent[key]; - const symbol = ReverseHierarchyMap.get(StrCast(parent[key])); + // const permission: string = key === 'acl-Public' && Doc.defaultAclPrivate ? AclPrivate : Doc.GetProto(parent)[key]; + const symbol = ReverseHierarchyMap.get(StrCast(Doc.GetProto(parent)[key])); if (symbol) { const sharePermission = HierarchyMapping.get(symbol.acl!)!.name; - key.startsWith('acl') && distributeAcls(key, sharePermission, child); + key.startsWith('acl') && distributeAcls(key, sharePermission, Doc.GetProto(child)); } } } @@ -277,10 +277,10 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc if (!target || visited.includes(target)) return; if ((target._type_collection === CollectionViewType.Docking && visited.length > 1) || Doc.GetProto(visited[0]) !== Doc.GetProto(target)) { target[key] = acl; - if (target !== Doc.GetProto(target)) { - //apparently we can't call updateCachedAcls twice (once for the main dashboard, and again for the nested dashboard...???) - updateCachedAcls(target); - } + // if (target !== Doc.GetProto(target)) { + // //apparently we can't call updateCachedAcls twice (once for the main dashboard, and again for the nested dashboard...???) + // updateCachedAcls(target); + // } //return; } visited.push(target); @@ -301,10 +301,12 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc let dataDocChanged = false; const dataDoc = target[DocData]; if (dataDoc && (!inheritingFromCollection || !dataDoc[key] || ReverseHierarchyMap.get(StrCast(dataDoc[key]))! > ReverseHierarchyMap.get(acl)!)) { - if (GetEffectiveAcl(dataDoc) === AclAdmin) { - dataDoc[key] = acl; - dataDocChanged = true; - } + + // changing doc proto - but this messes up layout + // if (GetEffectiveAcl(dataDoc) === AclAdmin) { + // dataDoc[key] = acl; + // dataDocChanged = true; + // } // maps over the links of the document LinkManager.Links(dataDoc).forEach(link => distributeAcls(key, acl, link, inheritingFromCollection, visited)); |