pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
416 stars 643 forks source link

Cannot break role inheritance for sub sites #1246

Open sebastianrogers opened 7 years ago

sebastianrogers commented 7 years ago

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you. If you have a actual question, we would ask you to use SharePoint Developer Group at Microsoft Tech Community. Thanks!

Which PnP repository should you use to report the issue?

Please navigate to the appropriate repository by clicking on the link below and create your issue there. You can delete this section after you have navigated to the correct repository.

Category

[X] Bug [ ] Enhancement

Environment

[X] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013

Expected or Desired Behavior

When specifying BreakRoleInheritance for subsites in a provisioning template it should break role inheritance

Observed Behavior

It does not break the role inheritance for the subsite

Steps to Reproduce

  1. Create a subsite.
  2. Check that inheritance has not been broken.
  3. Use the attached template.txt after renaming to template.xml Template.txt .
  4. Check that inheritance has been broken - FAIL it has not been broken

This has previously been reported as Bug #892 but does not seem to be fixed.

Thanks for your contribution! Sharing is caring.

ghost commented 7 years ago

@sebastianrogers I just ran across the same issue. I can confirm this template you provided will not break inheritance. I've tried on versions from 2.18.1709.1 (latest) and about four others, going back to 2.5.1606.3.

I'm out of time right now to test this --I noticed that you do not declare CopyRoleAssignments. I would try setting that to see if it helps. I also noticed that by simply adding a group to the security, that the inheritance did break.

ghost commented 7 years ago

More information: We were having issues with 2.16.1706.1 with a template that has <pnp:Security BreakRoleInheritance="true" CopyRoleAssignments="false" ClearSubscopes="true"> including groups and permissions. I tried @sebastianrogers template above and started testing out with different pnp versions where none worked, thinking that this was the exact same scenario.

However, going back to our template I realized that 2.16.1706.1 wasn't working but 2.18.1709.1 did work. Perhaps because we have the extra attributes or groups, as noted by the last comment. Hope this helps further in finding a solution.

waaromikniet commented 6 years ago

I noticed that it only works if something is between the tag. So when you add an extra group it does break the inheritance

waaromikniet commented 6 years ago

I have the same issue with the latest version off the core lib. Created a new issue #1509