Skip to content

Commit

Permalink
Merge pull request chocolatey#2811 from corbob/ps7-installs
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm authored Sep 15, 2022
2 parents 10c113a + 66d0289 commit 2d2490c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ param(
$ErrorActionPreference = 'Stop'
try {
# get current acl
$acl = (Get-Item $folder).GetAccessControl('Access,Owner')
$acl = Get-Acl $folder

Write-Debug "Removing existing permissions."
$acl.Access | ForEach-Object { $acl.RemoveAccessRuleAll($_) }
Expand Down Expand Up @@ -334,17 +334,17 @@ param(
$acl.SetAccessRuleProtection($true, $false)

# enact the changes against the actual
(Get-Item $folder).SetAccessControl($acl)
Set-Acl -Path $folder -AclObject $acl

# set an explicit append permission on the logs folder
Write-Debug "Allow users to append to log files."
$logsFolder = "$folder\logs"
Create-DirectoryIfNotExists $logsFolder
$logsAcl = (Get-Item $logsFolder).GetAccessControl('Access')
$logsAcl = Get-Acl $logsFolder
$usersAppendAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($builtinUsers, $rightsWrite, [Security.AccessControl.InheritanceFlags]::ObjectInherit, [Security.AccessControl.PropagationFlags]::InheritOnly, "Allow")
$logsAcl.SetAccessRule($usersAppendAccessRule)
$logsAcl.SetAccessRuleProtection($false, $true)
(Get-Item $logsFolder).SetAccessControl($logsAcl)
Set-Acl -Path $logsFolder -AclObject $logsAcl
} catch {
Write-ChocolateyWarning "Not able to set permissions for $folder."
}
Expand Down

0 comments on commit 2d2490c

Please sign in to comment.