Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Copies a Sitecore item access rights from one identity to another identity.
<#
.Synopsis
Copies an item access rights from one identity to another identity.
.EXAMPLE
Copy-ItemAcl -FromIdentity 'SUPER\ROBSONAUTOMATOR' -ToIdentity 'LAZY\ONE' -Path "/sitecore/content/Home"
.Author
Robert Senktas
#>
function Copy-ItemAcl{
[CmdletBinding()]
param(
# FromIdentity User name including domain
[Parameter(Mandatory=$true)]
[string]$FromIdentity,
# ToIdentity User name including domain
[Parameter(Mandatory=$true)]
[string]$ToIdentity,
[Parameter()]
# Path A path to the Sitecore item
[string]$Path
)
$acls = Get-ItemAcl -Path $Path -Identity $FromIdentity
$acls | % {Add-ItemAcl -Path $Path -Identity $ToIdentity -AccessRight $_.AccessRight -SecurityPermission $_.SecurityPermission -PropagationType $_.PropagationType }
#Get-ItemAcl -Path $Path -Identity $ToIdentity
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment