diff options
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 99712fb04..9c138d348 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -20,7 +20,6 @@ import { AclEdit, AclPrivate, AclReadonly, - AclSelfEdit, AclUnset, Animation, CachedUpdates, @@ -138,7 +137,7 @@ export const HierarchyMapping: Map<symbol, { level:aclLevel; name: SharingPermis [AclAdmin, { level: aclLevel.admin, name: SharingPermissions.Admin, image: '⬢' }], [AclUnset, { level: aclLevel.unset, name: SharingPermissions.Unset, image: '▲' }], ]); -export const ReverseHierarchyMap: Map<string, { level: aclLevel; acl: symbol ; image: string}> = new Map(Array.from(HierarchyMapping.entries()).map(value => [value[1].name, { level: value[1].level, acl: value[0], image: value[1].image }])); +export const ReverseHierarchyMap: Map<string, { level: aclLevel; acl: symbol; image: string }> = new Map(Array.from(HierarchyMapping.entries()).map(value => [value[1].name, { level: value[1].level, acl: value[0], image: value[1].image }])); // caches the document access permissions for the current user. // this recursively updates all protos as well. @@ -478,6 +477,14 @@ export namespace Doc { // }); // } + export function SetContainer(doc: Doc, container: Doc) { + doc.embedContainer = container; + if (Doc.GetProto(container).author === doc.author) { + Object.keys(Doc.GetProto(container)) + .filter(key => key.startsWith('acl')) + .forEach(key => (doc[key] = Doc.GetProto(container)[key])); + } + } export function RunCachedUpdate(doc: Doc, field: string) { const update = doc[CachedUpdates][field]; if (update) { |