Skip to content

Commit

Permalink
Fix condition for persist_permission() again
Browse files Browse the repository at this point in the history
  • Loading branch information
r15ch13 committed Aug 27, 2018
1 parent 936cf9c commit 1a2598b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1224,13 +1224,12 @@ function persist_data($manifest, $original_dir, $persist_dir) {

# check whether write permission for Users usergroup is set to global persist dir, if not then set
function persist_permission($manifest, $global) {
if(($global -and !$manifest.persist) -or !(is_admin)) {
return
if($global -and $manifest.persist -and (is_admin)) {
$path = persistdir $null $global
$user = New-Object System.Security.Principal.SecurityIdentifier 'S-1-5-32-545'
$target_rule = New-Object System.Security.AccessControl.FileSystemAccessRule($user, 'Write', 'ObjectInherit', 'none', 'Allow')
$acl = Get-Acl -Path $path
$acl.SetAccessRule($target_rule)
$acl | Set-Acl -Path $path
}
$path = persistdir $null $global
$user = New-Object System.Security.Principal.SecurityIdentifier 'S-1-5-32-545'
$target_rule = New-Object System.Security.AccessControl.FileSystemAccessRule($user, 'Write', 'ObjectInherit', 'none', 'Allow')
$acl = Get-Acl -Path $path
$acl.SetAccessRule($target_rule)
$acl | Set-Acl -Path $path
}

0 comments on commit 1a2598b

Please sign in to comment.