aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-08-04 01:38:55 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-08-04 01:38:55 +0530
commit2a5ed028c356e122acade2b695cdb56f727c681f (patch)
tree23786f61f4531e03c940b2ef361799e57a278e24 /src
parent9043bea3bda78b2adf1a5d841bfaf6bec903e3e1 (diff)
reinstated collection acl inheritance
Diffstat (limited to 'src')
-rw-r--r--src/client/views/DocComponent.tsx19
-rw-r--r--src/client/views/collections/CollectionView.tsx19
2 files changed, 18 insertions, 20 deletions
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index 804c7a8d4..34144d3eb 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -154,15 +154,16 @@ export function ViewBoxAnnotatableComponent<P extends ViewBoxAnnotatableProps, T
return false;
}
else {
- // if (this.props.Document[AclSym]) {
- // added.forEach(d => {
- // const dataDoc = d[DataSym];
- // dataDoc[AclSym] = d[AclSym] = this.props.Document[AclSym];
- // for (const [key, value] of Object.entries(this.props.Document[AclSym])) {
- // dataDoc[key] = d[key] = this.AclMap.get(value);
- // }
- // });
- // }
+ if (this.props.Document[AclSym]) {
+ added.forEach(d => {
+ const dataDoc = d[DataSym];
+ dataDoc[AclSym] = d[AclSym] = this.props.Document[AclSym];
+ for (const [key, value] of Object.entries(this.props.Document[AclSym])) {
+ dataDoc[key] = d[key] = this.AclMap.get(value);
+ }
+ });
+ }
+
if (effectiveAcl === AclAddonly) {
added.map(doc => Doc.AddDocToList(targetDataDoc, this.annotationKey, doc));
}
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 89034a0c0..44875ac1e 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -17,7 +17,7 @@ import { listSpec } from '../../../fields/Schema';
import { ComputedField, ScriptField } from '../../../fields/ScriptField';
import { BoolCast, Cast, NumCast, ScriptCast, StrCast } from '../../../fields/Types';
import { ImageField } from '../../../fields/URLField';
-import { TraceMobx, GetEffectiveAcl, SharingPermissions } from '../../../fields/util';
+import { TraceMobx, GetEffectiveAcl, SharingPermissions, distributeAcls } from '../../../fields/util';
import { emptyFunction, emptyPath, returnEmptyFilter, returnFalse, returnOne, returnZero, setupMoveUpEvents, Utils } from '../../../Utils';
import { Docs, DocUtils } from '../../documents/Documents';
import { DocumentType } from '../../documents/DocumentTypes';
@@ -147,16 +147,13 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
return false;
}
else {
- // if (this.props.Document[AclSym]) {
- // // change so it only adds if more restrictive
- // added.forEach(d => {
- // // const dataDoc = d[DataSym];
- // for (const [key, value] of Object.entries(this.props.Document[AclSym])) {
- // // key.substring(4).replace("_", ".") !== Doc.CurrentUserEmail && distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true);
- // distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true);
- // }
- // });
- // }
+ if (this.props.Document[AclSym]) {
+ added.forEach(d => {
+ for (const [key, value] of Object.entries(this.props.Document[AclSym])) {
+ distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true);
+ }
+ });
+ }
if (effectiveAcl === AclAddonly) {
added.map(doc => Doc.AddDocToList(targetDataDoc, this.props.fieldKey, doc));