From 7b9775c8b4eda4cf0f7f8067bf94c791b64d4d24 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Thu, 26 Oct 2017 09:19:46 +0200
Subject: [PATCH] First attempt to fix the ACL inheritance.

Refers to issue #16
---
 AutoTx/AutoTx.cs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs
index 32baafa..9d9aafd 100644
--- a/AutoTx/AutoTx.cs
+++ b/AutoTx/AutoTx.cs
@@ -678,7 +678,7 @@ namespace AutoTx
 
         #endregion
 
-        #region local filesystem tasks
+        #region filesystem tasks (check, move, ...)
 
         /// <summary>
         /// Check if a given directory is empty. If a marker file is set in the config a
@@ -835,6 +835,11 @@ namespace AutoTx
                         target += "_" + CreateTimestamp();
                     writeLogDebug(" - " + subDir.Name + " > " + target);
                     subDir.MoveTo(target);
+                    // force inheritance of ACLs for the moved directories (see
+                    // https://support.microsoft.com/en-us/help/320246 for more details):
+                    var acl = Directory.GetAccessControl(target);
+                    acl.SetAccessRuleProtection(false, false);
+                    Directory.SetAccessControl(target, acl);
                 }
             }
             catch (Exception ex) {
-- 
GitLab