diff options
author | geireann <geireann.lindfield@gmail.com> | 2022-12-21 02:06:32 -0500 |
---|---|---|
committer | geireann <geireann.lindfield@gmail.com> | 2022-12-21 02:06:32 -0500 |
commit | 24f9d90c2b465e8a87226ebcf5c9cfdcf7c9701c (patch) | |
tree | e0a0406126ff32b7f80e74e223eded607126df9b /src/fields | |
parent | 61683e5e084f0b3a6c53bde08295a25b53ea2db3 (diff) |
server side updates
Diffstat (limited to 'src/fields')
-rw-r--r-- | src/fields/util.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts index f222e4555..a53af5c19 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -352,7 +352,8 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc export function setter(target: any, in_prop: string | symbol | number, value: any, receiver: any): boolean { let prop = in_prop; - const effectiveAcl = getPropAcl(target, prop); + const effectiveAcl = in_prop === 'constructor' || typeof in_prop === 'symbol' ? AclAdmin : getPropAcl(target, prop); + if (effectiveAcl !== AclEdit && effectiveAcl !== AclAdmin && !(effectiveAcl === AclSelfEdit && value instanceof RichTextField)) return true; // if you're trying to change an acl but don't have Admin access / you're trying to change it to something that isn't an acceptable acl, you can't if (typeof prop === 'string' && prop.startsWith('acl') && (effectiveAcl !== AclAdmin || ![...Object.values(SharingPermissions), undefined, 'None'].includes(value))) return true; @@ -376,7 +377,7 @@ export function getter(target: any, in_prop: string | symbol | number, receiver: if (in_prop === AclSym) return target[AclSym]; if (in_prop === 'toString' || (in_prop !== HeightSym && in_prop !== WidthSym && in_prop !== LayoutSym && typeof prop === 'symbol')) return target.__fields[prop] || target[prop]; - if (GetEffectiveAcl(target) === AclPrivate) return prop === HeightSym || prop === WidthSym ? returnZero : undefined; + if (((typeof in_prop !== 'symbol' && in_prop !== 'constructor') || prop === HeightSym || prop === WidthSym) && GetEffectiveAcl(target) === AclPrivate) return prop === HeightSym || prop === WidthSym ? returnZero : undefined; if (prop === LayoutSym) return target.__LAYOUT__; if (typeof prop === 'string' && prop !== '__id' && prop !== '__fields' && prop.startsWith('_')) { if (!prop.startsWith('__')) prop = prop.substring(1); |