aboutsummaryrefslogtreecommitdiff
path: root/src/fields/util.ts
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2023-07-07 11:39:04 -0400
committersrichman333 <sarah_n_richman@brown.edu>2023-07-07 11:39:04 -0400
commit3dde1b790b0f29c0dca4d35ad91c1f389efe831a (patch)
tree951ed6eb7746fd7ecf680383d73d00343e80d16a /src/fields/util.ts
parentc5023c71527b9aa5dd788beafee55b895c682158 (diff)
changing + inheriting layout acls fix
Diffstat (limited to 'src/fields/util.ts')
-rw-r--r--src/fields/util.ts26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts
index 17eb47222..cc29c7df9 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -128,13 +128,13 @@ export function denormalizeEmail(email: string) {
* Copies parent's acl fields to the child
*/
export function inheritParentAcls(parent: Doc, child: Doc) {
- for (const key of Object.keys(parent)) {
+ for (const key of Object.keys(Doc.GetProto(parent))) {
// if the default acl mode is private, then don't inherit the acl-Public permission, but set it to private.
- // const permission: string = key === 'acl-Public' && Doc.defaultAclPrivate ? AclPrivate : parent[key];
- const symbol = ReverseHierarchyMap.get(StrCast(parent[key]));
+ // const permission: string = key === 'acl-Public' && Doc.defaultAclPrivate ? AclPrivate : Doc.GetProto(parent)[key];
+ const symbol = ReverseHierarchyMap.get(StrCast(Doc.GetProto(parent)[key]));
if (symbol) {
const sharePermission = HierarchyMapping.get(symbol.acl!)!.name;
- key.startsWith('acl') && distributeAcls(key, sharePermission, child);
+ key.startsWith('acl') && distributeAcls(key, sharePermission, Doc.GetProto(child));
}
}
}
@@ -277,10 +277,10 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc
if (!target || visited.includes(target)) return;
if ((target._type_collection === CollectionViewType.Docking && visited.length > 1) || Doc.GetProto(visited[0]) !== Doc.GetProto(target)) {
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);
- }
+ // 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);
+ // }
//return;
}
visited.push(target);
@@ -301,10 +301,12 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc
let dataDocChanged = false;
const dataDoc = target[DocData];
if (dataDoc && (!inheritingFromCollection || !dataDoc[key] || ReverseHierarchyMap.get(StrCast(dataDoc[key]))! > ReverseHierarchyMap.get(acl)!)) {
- if (GetEffectiveAcl(dataDoc) === AclAdmin) {
- dataDoc[key] = acl;
- dataDocChanged = true;
- }
+
+ // changing doc proto - but this messes up layout
+ // if (GetEffectiveAcl(dataDoc) === AclAdmin) {
+ // dataDoc[key] = acl;
+ // dataDocChanged = true;
+ // }
// maps over the links of the document
LinkManager.Links(dataDoc).forEach(link => distributeAcls(key, acl, link, inheritingFromCollection, visited));