1

I was trying to deny write access to Everyone role for my Sitecore Content tree nodes. There are many nodes and lot of items have write access for Everyone user , which we want to restrict now.

I tried using below scirpt , but it only works with the single item and not propagating to its children.

I used PropagationType as Any and Descendants both but it does not propagate to its child level. As a work around , I have to loop through the tree items and run the command.

$acl1 = New-ItemAcl -AccessRight write -PropagationType Any -SecurityPermission DenyAccess  -Identity Everyone

Instead of this line

foreach($item in $items)
{    
    $item|Set-ItemAcl -AccessRules $acl1 
}

I want to do

get-item -Path "master:content/My-Node/Home |Set-ItemAcl -AccessRules $acl1 

to reflect the write access restriction to all the child items under Home.

I am not sure if it is a bug or I am doing it wrongly .. If you have come across this, your guidance would be helpful.

I used Sitecore 9.3 rev. 003498.

1 Answer 1

1

Instead of using get-item you need to use Get-ChildItem to achieve this.

So your query will look like this.

$acl2 = New-ItemAcl -AccessRight item:write -PropagationType Descendants -SecurityPermission AllowAccess -Identity "default\Everyone"
Get-ChildItem master:\content\home | Set-ItemAcl -AccessRules $acl1, $acl2 -PassThru

If will set the Write access to all the child items under the home node. So the resulting output will be this.

enter image description here

1
  • Your suggestion worked. However I realized that earlier code also worked for child items but those items which had "Everyone" allowed access, it did not work on those items. But your code worked for all item including those which were having "allow" access by Everyone. Thanks for the suggestion. Commented Oct 7, 2022 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.