Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion RestSetAcls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,17 @@ The terminology used in this module is explained below:

- **Security Descriptor**: A structure that encodes the owner, group, and permissions of a file or folder.
- **Access Control List (ACL)**: The part of the security descriptor that encodes the permissions of a file or folder. Since the ACL is the most important part of the security descriptor, we often use "ACL" to refer to the entire security descriptor, including owner and group.
- **Access Control Entry (ACE)**: An entry in the ACL that encodes the permissions for a specific user or group.
- **Access Control Entry (ACE)**: An entry in the ACL that encodes the permissions for a specific user or group.

## Uninstall

To uninstall, run:

```powershell
Uninstall-Module RestSetAcls
```

To uninstall dependencies that were installed along with RestSetAcls, see:

- [Uninstall Az PowerShell](https://learn.microsoft.com/en-us/powershell/azure/uninstall-az-ps?view=azps-15.1.0)
- [Uninstall Microsoft Graph PowerShell](https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation?view=graph-powershell-1.0#uninstalling-the-sdk)
2 changes: 1 addition & 1 deletion RestSetAcls/RestSetAcls/RestSetAcls.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'RestSetAcls.psm1'

# Version number of this module.
ModuleVersion = '0.2.9'
ModuleVersion = '0.2.10'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
18 changes: 7 additions & 11 deletions RestSetAcls/RestSetAcls/RestSetAcls.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ Get-ChildItem -Path "$PSScriptRoot/Types/*.ps1" | ForEach-Object { . $_.FullName
Get-ChildItem -Path "$PSScriptRoot/Helpers/*.ps1" | ForEach-Object { . $_.FullName }

function Write-LiveFilesAndFoldersProcessingStatus {
[OutputType([int])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
"PSReviewUnusedParameter",
"FileOrFolder",
Justification = "We don't print `$FileOrFolder but we do want to iterate over it")]
[OutputType([hashtable])]
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[Object[]]$FileOrFolder,
[hashtable]$Item,

[Parameter(Mandatory = $true)]
[datetime]$StartTime,
Expand All @@ -35,13 +31,13 @@ function Write-LiveFilesAndFoldersProcessingStatus {
process {
# If silent mode is enabled, do not print anything, just forward to pipeline
if ($Silent) {
return $_
return $Item
}

$i++
$timeSinceLastPrint = (Get-Date) - $lastPrint

if (-not $_.Success) {
if (-not $Item["Success"]) {
$failures++
}

Expand Down Expand Up @@ -73,7 +69,7 @@ function Write-LiveFilesAndFoldersProcessingStatus {
$lastPrint = Get-Date
}

Write-Output $_
Write-Output $Item
}
}

Expand Down Expand Up @@ -1089,7 +1085,7 @@ function Set-AzFileAclRecursive {

# Set the ACL
try {
Set-AzFileAclKey -File $_.File -Key $filePermissionKey -WhatIf:$WhatIfPreference
Set-AzFileAclKey -File $_.File -Key $filePermissionKey -WhatIf:$WhatIfPreference | Out-Null
}
catch {
$success = $false
Expand All @@ -1115,7 +1111,7 @@ function Set-AzFileAclRecursive {
Success = $success
ErrorMessage = $errorMessage
}
}
}
} `
| Write-LiveFilesAndFoldersProcessingStatus -RefreshRateHertz 10 -StartTime $startTime -Silent:$Silent `
| ForEach-Object { if ($PassThru) { Write-Output $_ } }
Expand Down