public void Dispose() { if (this.isUsingAppContainer) { AppContainerProtection appContainerProtection = serviceProvider.GetService <AppContainerProtection>(); Console.WriteLine( "Removing access for AppContainer '{0}' from directory '{1}'", appContainerProtection.AppContainer.SecurityIdentifier, Environment.CurrentDirectory); Process .Start( "icacls.exe", $"{Environment.CurrentDirectory} /remove *{appContainerProtection.AppContainer.SecurityIdentifier}") .WaitForExit(); } }
public AppContainerPermissionScope(Parameters parameters, IServiceProvider serviceProvider) { this.isUsingAppContainer = parameters.AppContainer; this.serviceProvider = serviceProvider; if (this.isUsingAppContainer) { AppContainerProtection appContainerProtection = serviceProvider.GetService <AppContainerProtection>(); Console.WriteLine( "Assigning access to AppContainer '{0}' for directory '{1}'", appContainerProtection.AppContainer.SecurityIdentifier, Environment.CurrentDirectory); Process .Start( "icacls.exe", $"{Environment.CurrentDirectory} /grant *{appContainerProtection.AppContainer.SecurityIdentifier}:(OI)(CI)(F)") .WaitForExit(); } }