diff options
Diffstat (limited to 'src/fields')
| -rw-r--r-- | src/fields/Doc.ts | 3 | ||||
| -rw-r--r-- | src/fields/util.ts | 6 |
2 files changed, 2 insertions, 7 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 5e2e40979..68279372a 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -102,7 +102,6 @@ export const AclUnset = Symbol('AclUnset'); export const AclPrivate = Symbol('AclOwnerOnly'); export const AclReadonly = Symbol('AclReadOnly'); export const AclAugment = Symbol('AclAugment'); -export const AclSelfEdit = Symbol('AclSelfEdit'); export const AclEdit = Symbol('AclEdit'); export const AclAdmin = Symbol('AclAdmin'); export const UpdatingFromServer = Symbol('UpdatingFromServer'); @@ -115,7 +114,6 @@ export enum aclLevel { unshared = 0, viewable = 1, augmentable = 2, - selfEditable = 2.5, editable = 3, admin = 4, } @@ -124,7 +122,6 @@ export const HierarchyMapping: Map<symbol, { level:aclLevel; name: SharingPermis [AclPrivate, { level: aclLevel.unshared, name: SharingPermissions.None }], [AclReadonly, { level: aclLevel.viewable, name: SharingPermissions.View }], [AclAugment, { level: aclLevel.augmentable, name: SharingPermissions.Augment}], - [AclSelfEdit, { level: aclLevel.selfEditable, name: SharingPermissions.SelfEdit }], [AclEdit, { level: aclLevel.editable, name: SharingPermissions.Edit }], [AclAdmin, { level: aclLevel.admin, name: SharingPermissions.Admin }], [AclUnset, { level: aclLevel.unset, name: SharingPermissions.Unset }], diff --git a/src/fields/util.ts b/src/fields/util.ts index c1e1a7111..b0ad4db5d 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -14,7 +14,6 @@ import { aclLevel, AclPrivate, AclReadonly, - AclSelfEdit, AclSym, DataSym, Doc, @@ -87,7 +86,7 @@ const _setterImpl = action(function (target: any, prop: string | symbol | number const fromServer = target[UpdatingFromServer]; const sameAuthor = fromServer || receiver.author === Doc.CurrentUserEmail; const writeToDoc = sameAuthor || effectiveAcl === AclEdit || effectiveAcl === AclAugment || effectiveAcl === AclAdmin || writeMode !== DocServer.WriteMode.LiveReadonly; - const writeToServer = (sameAuthor || effectiveAcl === AclEdit || effectiveAcl === AclAugment || effectiveAcl === AclAdmin || (effectiveAcl === AclSelfEdit && value instanceof RichTextField)) && !DocServer.Control.isReadOnly(); + const writeToServer = (sameAuthor || effectiveAcl === AclEdit || effectiveAcl === AclAugment || effectiveAcl === AclAdmin ) && !DocServer.Control.isReadOnly(); if (writeToDoc) { if (value === undefined) { @@ -171,7 +170,6 @@ export enum SharingPermissions { Unset = 'None', Admin = 'Admin', Edit = 'Edit', - SelfEdit = 'Self-Edit', Augment = 'Augment', View = 'View', None = 'Not-Shared', @@ -330,7 +328,7 @@ 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 = in_prop === 'constructor' || typeof in_prop === 'symbol' ? AclAdmin : getPropAcl(target, prop); - if (effectiveAcl !== AclEdit && effectiveAcl !== AclAugment && effectiveAcl !== AclAdmin && !(effectiveAcl === AclSelfEdit && value instanceof RichTextField)) return true; + if (effectiveAcl !== AclEdit && effectiveAcl !== AclAugment && effectiveAcl !== AclAdmin ) 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].includes(value))) return true; |
