diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-04-02 19:04:09 -0400 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-04-02 19:04:09 -0400 |
commit | bd6b9c40f150fab76e8907c45e29fa809f9acae0 (patch) | |
tree | 30ee435654f640476a4745bf47524c2ff1f53d51 /src/fields/util.ts | |
parent | ec2748cf3deaa791c5aae6eae11b36f3cd4c0099 (diff) |
dashboard sharing initial setup, inherits acls from dashboard - looks like it works
Diffstat (limited to 'src/fields/util.ts')
-rw-r--r-- | src/fields/util.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts index ea91cc057..a4c99928a 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -131,6 +131,19 @@ export function denormalizeEmail(email: string) { // playgroundMode = !playgroundMode; // } + +/** + * Copies parent's acl fields to the child + */ +export function inheritParentAcls(parent: Doc, child: Doc) { + if (parent.isShared) { + const dataDoc = parent[DataSym]; + for (const key of Object.keys(dataDoc)) { + key.startsWith("acl") && distributeAcls(key, dataDoc[key], child); + } + } +} + /** * These are the various levels of access a user can have to a document. * @@ -245,7 +258,7 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc dataDocChanged = true; } - // maps over the aliases of the document + // maps over the links of the document const links = DocListCast(dataDoc.links); links.forEach(link => distributeAcls(key, acl, link, inheritingFromCollection, visited)); |