diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/DocumentDecorations.tsx | 13 | ||||
-rw-r--r-- | src/fields/util.ts | 6 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index c4c6b6488..db164a33a 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -164,9 +164,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P @action onContainerDown = (e: React.PointerEvent): void => { const first = SelectionManager.Views()[0]; - const effectiveAcl = GetEffectiveAcl(first.rootDoc); - console.log(GetEffectiveLayoutAcl(first)) - if (effectiveAcl == AclAdmin || effectiveAcl == AclEdit || effectiveAcl == AclAugment) { + const effectiveLayoutAcl = GetEffectiveLayoutAcl(first.rootDoc); + if (effectiveLayoutAcl == AclAdmin || effectiveLayoutAcl == AclEdit || effectiveLayoutAcl == AclAugment) { setupMoveUpEvents( this, e, @@ -179,8 +178,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P @action onTitleDown = (e: React.PointerEvent): void => { const first = SelectionManager.Views()[0]; - const effectiveAcl = GetEffectiveAcl(first.rootDoc); - if (effectiveAcl == AclAdmin || effectiveAcl == AclEdit || effectiveAcl == AclAugment) { + const effectiveLayoutAcl = GetEffectiveLayoutAcl(first.rootDoc); + if (effectiveLayoutAcl == AclAdmin || effectiveLayoutAcl == AclEdit || effectiveLayoutAcl == AclAugment) { setupMoveUpEvents( this, e, @@ -200,8 +199,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P @action onBackgroundMove = (dragTitle: boolean, e: PointerEvent): boolean => { const first = SelectionManager.Views()[0]; - const effectiveAcl = GetEffectiveAcl(first.rootDoc); - if (effectiveAcl != AclAdmin && effectiveAcl != AclEdit && effectiveAcl != AclAugment){ + const effectiveLayoutAcl = GetEffectiveLayoutAcl(first.rootDoc); + if (effectiveLayoutAcl != AclAdmin && effectiveLayoutAcl != AclEdit && effectiveLayoutAcl != AclAugment){ return false; } const dragDocView = SelectionManager.Views()[0]; diff --git a/src/fields/util.ts b/src/fields/util.ts index 9fb65c251..f31213869 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -17,7 +17,6 @@ import { RefField } from './RefField'; import { SchemaHeaderField } from './SchemaHeaderField'; import { ComputedField } from './ScriptField'; import { ScriptCast, StrCast } from './Types'; -import { GroupManager } from '../client/util/GroupManager'; function _readOnlySetter(): never { throw new Error("Documents can't be modified in read-only mode"); @@ -181,12 +180,13 @@ export function GetEffectiveAcl(target: any, user?: string): symbol { } /** - * Calculates the effective access layout right to a document for the current user. + * Calculates the effective access layout right to a document for the current user. By getting the container's effective acl if the layout acl isn't set. */ export function GetEffectiveLayoutAcl(target: any, user?: string): symbol { if (!target) return AclPrivate; if (target[UpdatingFromServer]) return AclAdmin; - return getEffectiveAclCache(target, user); // all changes received from the server must be processed as Admin. return this directly so that the acls aren't cached (UpdatingFromServer is not observable) + // if (getEffectiveAclCache(target, user)) return getEffectiveAclCache(target, user); + return getEffectiveAclCache(Doc.GetProto(target['embedContainer']), user); } function getPropAcl(target: any, prop: string | symbol | number) { |