Skip to content

Commit

Permalink
refactor(install): Get reference for Users group via Enum
Browse files Browse the repository at this point in the history
  • Loading branch information
refack committed Jan 21, 2025
1 parent ac6f1ba commit 7f2802c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,12 @@ function unlink_persist_data($manifest, $dir) {
}
}

# check whether write permission for Users usergroup is set to global persist dir, if not then set
# set write permission for Users usergroup to global persist dir
function persist_permission($manifest, $global) {
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')
$builtinUsersSid = New-Object System.Security.Principal.SecurityIdentifier([System.Security.Principal.WellKnownSidType]::BuiltinUsersSid, $null)
$target_rule = New-Object System.Security.AccessControl.FileSystemAccessRule($builtinUsersSid, 'Write', 'ObjectInherit', 'none', 'Allow')
$acl = Get-Acl -Path $path
$acl.SetAccessRule($target_rule)
$acl | Set-Acl -Path $path
Expand Down

0 comments on commit 7f2802c

Please sign in to comment.