From abcf1167340f9f411e7712d11f2110625b0938d8 Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Thu, 4 May 2023 15:45:50 -0400
Subject: simple checkbox so that users can choose to override more private acl
 docs

---
 src/client/util/SharingManager.tsx | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

(limited to 'src/client/util/SharingManager.tsx')

diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx
index 40a282db0..aa9fc4433 100644
--- a/src/client/util/SharingManager.tsx
+++ b/src/client/util/SharingManager.tsx
@@ -82,6 +82,7 @@ export class SharingManager extends React.Component<{}> {
     @observable private showGroupOptions: boolean = false; // // whether to show groups as options when sharing (in the react-select component)
     private populating: boolean = false; // whether the list of users is populating or not
     @observable private layoutDocAcls: boolean = false; // whether the layout doc or data doc's acls are to be used
+    @observable private overridePrivate: boolean = false; // whether child docs in a collection/dashboard should be changed to be less private
     @observable private myDocAcls: boolean = false; // whether the My Docs checkbox is selected or not
 
     // private get linkVisible() {
@@ -161,10 +162,12 @@ export class SharingManager extends React.Component<{}> {
         const isDashboard = DocListCast(Doc.MyDashboards.data).indexOf(target) !== -1;
         
         // setting the same acl for a docs within the doc being shared
-        var childDocs = DocListCast(target.data)
-        childDocs.map(doc => {
-            this.setInternalSharing(recipient, permission, doc)
-        })
+        if (this.overridePrivate){
+            var childDocs = DocListCast(target.data)
+            childDocs.map(doc => {
+                this.setInternalSharing(recipient, permission, doc)
+            })
+        }
 
         const docs = SelectionManager.Views().length < 2 ? [target] : SelectionManager.Views().map(docView => docView.props.Document);
 
@@ -200,10 +203,12 @@ export class SharingManager extends React.Component<{}> {
         const isDashboard = DocListCast(Doc.MyDashboards.data).indexOf(target) !== -1;
         
         // setting the same acl for a docs within the doc being shared
-        var childDocs = DocListCast(target.data)
-        childDocs.map(doc => {
-            this.setInternalGroupSharing(group, permission, doc)
-        })
+        if (this.overridePrivate){
+            var childDocs = DocListCast(target.data)
+            childDocs.map(doc => {
+                this.setInternalGroupSharing(group, permission, doc)
+            })
+        }
 
         const docs = SelectionManager.Views().length < 2 ? [target] : SelectionManager.Views().map(docView => docView.props.Document);
 
@@ -275,7 +280,7 @@ export class SharingManager extends React.Component<{}> {
             const dashboards = DocListCast(Doc.MyDashboards.data);
             docs.forEach(doc => {
                 const isDashboard = dashboards.indexOf(doc) !== -1;
-                this.shareFromPropertiesSidebar(shareWith, permission, DocListCast(doc.data))
+                if (this.overridePrivate) this.shareFromPropertiesSidebar(shareWith, permission, DocListCast(doc.data))
                 if (GetEffectiveAcl(doc) === AclAdmin) distributeAcls(`acl-${shareWith}`, permission, doc, undefined, undefined, isDashboard);
                 this.setDashboardBackground(doc, permission as SharingPermissions);
             });
@@ -648,6 +653,7 @@ export class SharingManager extends React.Component<{}> {
                             <div className="acl-container">
                                 {Doc.noviceMode ? null : (
                                     <div className="layoutDoc-acls">
+                                        <input type="checkbox" onChange={action(() => (this.overridePrivate = !this.overridePrivate))} checked={this.overridePrivate} /> <label>Override Private </label>
                                         <input type="checkbox" onChange={action(() => (this.layoutDocAcls = !this.layoutDocAcls))} checked={this.layoutDocAcls} /> <label>Layout</label>
                                     </div>
                                 )}
-- 
cgit v1.2.3-70-g09d2

