diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2023-06-23 11:11:07 -0400 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2023-06-23 11:11:07 -0400 |
commit | 32239432b79664f577bf0c84d4688c4e5cf7f14f (patch) | |
tree | b581d7cbaf0f4ae40b7967a084fe9a0ac283184c | |
parent | 1a9ecbb274e7b95a5b1dca6c45c329d9a32432c7 (diff) |
acls in proto so that layout acls start cleared
-rw-r--r-- | src/client/documents/Documents.ts | 6 | ||||
-rw-r--r-- | src/client/util/SharingManager.tsx | 3 | ||||
-rw-r--r-- | src/client/views/DocComponent.tsx | 2 | ||||
-rw-r--r-- | src/client/views/PropertiesView.tsx | 4 | ||||
-rw-r--r-- | src/fields/util.ts | 2 |
5 files changed, 9 insertions, 8 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 7dde70a2e..05994ebbd 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -839,9 +839,7 @@ export namespace Docs { const { omit: dataProps, extract: viewProps } = OmitKeys(options, viewKeys, '^_'); // dataProps['acl-Override'] = SharingPermissions.Unset; - if (dataProps['acl-Public'] == undefined && Doc.GetProto(dataProps)['acl-Public'] == undefined){ - dataProps['acl-Public'] = options['acl-Public'] ? options['acl-Public'] : Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.Augment; - } + dataProps['acl-Public'] = options['acl-Public'] ? options['acl-Public'] : Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.Augment; dataProps.isSystem = viewProps.isSystem; dataProps.isDataDoc = true; @@ -859,7 +857,7 @@ export namespace Docs { // users placeholderDoc as proto if it exists const dataDoc = Doc.assign(placeholderDoc ? Doc.GetProto(placeholderDoc) : Doc.MakeDelegate(proto, protoId), dataProps, undefined, true); - + if (placeholderDoc) { dataDoc.proto = proto; } diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx index 3a3d393a0..a95874fd7 100644 --- a/src/client/util/SharingManager.tsx +++ b/src/client/util/SharingManager.tsx @@ -174,7 +174,7 @@ export class SharingManager extends React.Component<{}> { // ! ensures it returns true if document has been shared successfully, false otherwise return !docs - .map(doc => (this.layoutDocAcls ? doc : doc[DocData])) + .map(doc => (this.layoutDocAcls ? doc : Doc.GetProto(doc))) .map(doc => { doc.author === Doc.CurrentUserEmail && !doc[myAcl] && distributeAcls(myAcl, SharingPermissions.Admin, doc, undefined, undefined, isDashboard); @@ -339,6 +339,7 @@ export class SharingManager extends React.Component<{}> { const acl = `acl-${StrCast(group.title)}`; const isDashboard = dashboards.indexOf(doc) !== -1; distributeAcls(acl, SharingPermissions.None, doc, undefined, undefined, isDashboard); + distributeAcls(acl, SharingPermissions.None, Doc.GetProto(doc), undefined, undefined, isDashboard); const members: string[] = JSON.parse(StrCast(group.members)); const users: ValidatedUser[] = this.users.filter(({ user: { email } }) => members.includes(email)); diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx index 98aa9f880..6f350e0fc 100644 --- a/src/client/views/DocComponent.tsx +++ b/src/client/views/DocComponent.tsx @@ -199,7 +199,7 @@ export function ViewBoxAnnotatableComponent<P extends ViewBoxAnnotatableProps>() const permissionString = StrCast(Doc.GetProto(this.props.Document)[key]) const permissionSymbol = ReverseHierarchyMap.get(permissionString)!.acl const permission = HierarchyMapping.get(permissionSymbol)!.name - distributeAcls(key, permission, d) + distributeAcls(key, permission, Doc.GetProto(d)) } }) ); diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index 825a802cd..6bca08d23 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -425,12 +425,14 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { * @returns the sharing and permissions panel. */ @computed get sharingTable() { + console.log('doc', this.selectedDoc) + console.log('proto', Doc.GetProto(this.selectedDoc!)) // all selected docs const docs = SelectionManager.Views().length < 2 && this.selectedDoc ? [this.layoutDocAcls ? this.selectedDoc : this.dataDoc!] : SelectionManager.Views().map(docView => (this.layoutDocAcls ? docView.props.Document : docView.props.Document[DocData])); const target = docs[0]; - const showAdmin = GetEffectiveAcl(this.selectedDoc!) == AclAdmin + const showAdmin = GetEffectiveAcl(target) == AclAdmin const individualTableEntries = []; const usersAdded: string[] = []; // all shared users being added - organized by denormalized email diff --git a/src/fields/util.ts b/src/fields/util.ts index f31213869..1ac450b9a 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -242,7 +242,7 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc if (!visited) visited = [] as Doc[]; if (!target || visited.includes(target)) return; if ((target._type_collection === CollectionViewType.Docking && visited.length > 1) || Doc.GetProto(visited[0]) !== Doc.GetProto(target)) { - Doc.GetProto(target)[key] = acl; + target[key] = acl; if (target !== Doc.GetProto(target)) { //apparently we can't call updateCachedAcls twice (once for the main dashboard, and again for the nested dashboard...???) updateCachedAcls(target); |