Make ResetAcl opt-in instead of opt-out
Rob Mensching committed
Mar 16, 2021 at 16:12 UTC
fb2e8cb8a28a2a1a84909a8793a57d0d575da610
4 files changed
+14
-12
src/WixToolset.Core/Bind/TransferFilesCommand.cs
+5
-5
@@ -13,12 +13,12 @@ namespace WixToolset.Core.Bind
13
14
internal class TransferFilesCommand
15
{
16
- public TransferFilesCommand(IMessaging messaging, IEnumerable<ILayoutExtension> extensions, IEnumerable<IFileTransfer> fileTransfers, bool suppressAclReset)
16
+ public TransferFilesCommand(IMessaging messaging, IEnumerable<ILayoutExtension> extensions, IEnumerable<IFileTransfer> fileTransfers, bool resetAcls)
17
{
18
this.Extensions = extensions;
19
this.Messaging = messaging;
20
this.FileTransfers = fileTransfers;
21
- this.SuppressAclReset = suppressAclReset;
21
+ this.ResetAcls = resetAcls;
22
}
23
24
private IMessaging Messaging { get; }
@@ -27,7 +27,7 @@ namespace WixToolset.Core.Bind
27
28
private IEnumerable<IFileTransfer> FileTransfers { get; }
29
30
- private bool SuppressAclReset { get; }
30
+ private bool ResetAcls { get; }
31
32
public void Execute()
33
{
@@ -152,9 +152,9 @@ namespace WixToolset.Core.Bind
152
} while (retry);
153
}
154
155
- // Finally, if there were any files remove the ACL that may have been added to
155
+ // Finally, if directed then reset remove ACLs that may may have been picked up
156
// during the file transfer process.
157
- if (0 < destinationFiles.Count && !this.SuppressAclReset)
157
+ if (this.ResetAcls && 0 < destinationFiles.Count)
158
{
159
try
160
{
src/WixToolset.Core/CommandLine/BuildCommand.cs
+7
-1
@@ -372,7 +372,7 @@ namespace WixToolset.Core.CommandLine
372
context.ContentsFile = this.ContentsFile;
373
context.OutputsFile = this.OutputsFile;
374
context.BuiltOutputsFile = this.BuiltOutputsFile;
375
- context.SuppressAclReset = false; // TODO: correctly set SuppressAclReset
375
+ context.ResetAcls = this.commandLine.ResetAcls;
376
context.CancellationToken = cancellationToken;
377
378
var layout = this.ServiceProvider.GetService<ILayoutCreator>();
@@ -547,6 +547,8 @@ namespace WixToolset.Core.CommandLine
547
548
public bool SuppressValidation { get; set; }
549
550
+ public bool ResetAcls { get; set; }
551
+
552
public CommandLine(IServiceProvider serviceProvider, IMessaging messaging)
553
{
554
this.ServiceProvider = serviceProvider;
@@ -702,6 +704,10 @@ namespace WixToolset.Core.CommandLine
704
case "sval":
705
this.SuppressValidation = true;
706
return true;
707
+
708
+ case "resetacls":
709
+ this.ResetAcls = true;
710
+ return true;
711
}
712
713
if (parameter.StartsWith("sw"))
src/WixToolset.Core/LayoutContext.cs
+1
-1
@@ -33,7 +33,7 @@ namespace WixToolset.Core
33
34
public string BuiltOutputsFile { get; set; }
35
36
- public bool SuppressAclReset { get; set; }
36
+ public bool ResetAcls { get; set; }
37
38
public CancellationToken CancellationToken { get; set; }
39
}
src/WixToolset.Core/LayoutCreator.cs
+1
-5
@@ -18,13 +18,9 @@ namespace WixToolset.Core
18
{
19
internal LayoutCreator(IServiceProvider serviceProvider)
20
{
21
- this.ServiceProvider = serviceProvider;
22
-
21
this.Messaging = serviceProvider.GetService<IMessaging>();
22
}
23
26
- private IServiceProvider ServiceProvider { get; }
27
-
24
private IMessaging Messaging { get; }
25
26
public void Layout(ILayoutContext context)
@@ -44,7 +40,7 @@ namespace WixToolset.Core
40
{
41
this.Messaging.Write(VerboseMessages.LayingOutMedia());
42
47
- var command = new TransferFilesCommand(this.Messaging, context.Extensions, context.FileTransfers, context.SuppressAclReset);
43
+ var command = new TransferFilesCommand(this.Messaging, context.Extensions, context.FileTransfers, context.ResetAcls);
44
command.Execute();
45
}
46