Public/permissions.ps1
function Set-RKPermissions { <# .Description Takes the contents of a json permissions files and applies the permissions #> [CmdletBinding()] param([PSCustomObject[]]$Permissions) foreach ($Permission in $Permissions) { Write-Host "applyPermissionSet: $($Permission | ConvertTo-Json)" switch ($Permission.type) { "rbac" { Set-RKRbacPermission $Permission } "sql" { Set-RKSQLPermission $Permission} "datalake" { Set-RKDataLakeAcl $Permission } Default { throw "Unknown Type - $($Permission.type)" } } Write-Host "applyPermissionSet: $($Permission | ConvertTo-Json)...done" } Update-RKLakeFromCache } function Set-RKDataLakeAcl { <# .Description Set the permission on a Data Folder and parent folders (to reach the folder) #> [CmdletBinding()] param([PSCustomObject[]]$Permission) $DataLakeName = $Permission.dataLakeName $ContainerName = $Permission.containerName $ignoreUpperFolder = $Permission.ignoreUpperFolder ? $Permission.ignoreUpperFolder : $false $ctx = Get-RKStorageContext -StorageAccountName $DataLakeName -ContainerName $ContainerName Write-Verbose "applyLakePermission: objectType: '$($Permission.principalType)', DisplayName: '$($Permission.principalName)', Permission: '$($Permission.permission)', path: '$($Permission.path)'" Set-RKLakePathAcl -ctx $ctx -ContainerName $ContainerName -ObjectType $Permission.principalType -DisplayName $Permission.principalName -Permissions $Permission.permission -Path $Permission.path -IgnoreUpperFolder $ignoreUpperFolder } |