diff options
Diffstat (limited to 'src/fields')
| -rw-r--r-- | src/fields/Doc.ts | 2 | ||||
| -rw-r--r-- | src/fields/util.ts | 47 |
2 files changed, 27 insertions, 22 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 88587b3c1..555e768c1 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -145,7 +145,7 @@ export const ReverseHierarchyMap: Map<string, { level: aclLevel; acl: symbol }> export function updateCachedAcls(doc: Doc) { if (!doc) return; - const target = (doc as any)?.__fields ?? doc; + const target = (doc as any)?.__fieldTuples ?? doc; const permissions: { [key: string]: symbol } = !target.author || target.author === Doc.CurrentUserEmail ? { 'acl-Me': AclAdmin } : {}; Object.keys(target).filter(key => key.startsWith('acl') && (permissions[key] = ReverseHierarchyMap.get(StrCast(target[key]))!.acl)); if (Object.keys(permissions).length || doc[DocAcl]?.length) { diff --git a/src/fields/util.ts b/src/fields/util.ts index 6058a5a5f..e0f87f805 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -8,27 +8,32 @@ import { UndoManager } from '../client/util/UndoManager'; import { returnZero } from '../Utils'; import CursorField from './CursorField'; import { - AclAdmin, - AclEdit, - aclLevel, - AclPrivate, - AclSelfEdit, - AclSym, - DataSym, Doc, + aclLevel, DocListCast, DocListCastAsync, - ForceServerWrite, - HeightSym, HierarchyMapping, - Initializing, - LayoutSym, ReverseHierarchyMap, updateCachedAcls, - UpdatingFromServer, - WidthSym, } from './Doc'; -import { Id, OnUpdate, Parent, SelfProxy, ToValue, Update } from './FieldSymbols'; +import { + AclAdmin, + AclEdit, + AclPrivate, + AclAugment, + FieldKeys, + DocAcl, + DocData, + ForceServerWrite, + Height, + Initializing, + DocLayout, + UpdatingFromServer, + Width, + SelfProxy, + Update +} from './DocSymbols'; +import { Id, OnUpdate, Parent, ToValue } from './FieldSymbols'; import { List } from './List'; import { ObjectField } from './ObjectField'; import { PrefetchProxy, ProxyField } from './Proxy'; @@ -150,12 +155,12 @@ export function denormalizeEmail(email: string) { */ export function inheritParentAcls(parent: Doc, child: Doc) { return; - const dataDoc = parent[DataSym]; - for (const key of Object.keys(dataDoc)) { - // if the default acl mode is private, then don't inherit the acl-Public permission, but set it to private. - const permission = key === 'acl-Public' && Doc.defaultAclPrivate ? AclPrivate : dataDoc[key]; - key.startsWith('acl') && distributeAcls(key, permission, child); - } + // const dataDoc = parent[DocData]; + // for (const key of Object.keys(dataDoc)) { + // // if the default acl mode is private, then don't inherit the acl-Public permission, but set it to private. + // const permission = key === 'acl-Public' && Doc.defaultAclPrivate ? AclPrivate : dataDoc[key]; + // key.startsWith('acl') && distributeAcls(key, permission, child); + // } } /** @@ -214,7 +219,7 @@ export function SetCachedGroups(groups: string[]) { runInAction(() => cachedGroups.push(...groups)); } function getEffectiveAcl(target: any, user?: string): symbol { - const targetAcls = target[AclSym]; + const targetAcls = target[DocAcl]; if (targetAcls?.['acl-Me'] === AclAdmin || GetCachedGroupByName('Admin')) return AclAdmin; const userChecked = user || Doc.CurrentUserEmail; // if the current user is the author of the document / the current user is a member of the admin group |
