Changing access permissions for a page

Vote:
 

Hi!

Here's a question for you..

Page A has 3 sub pages sitting beneath it in a page tree within the CMS, and Role A is allowed to edit / read these pages, but not to delete or create new pages under Page A.

Page B has 3 sub pages in exactly the same fashion, and Role B is allowed to modify Page B and its children in the same way.

What I want to do is move a child from Page A to Page B, but I want this page to now be assigned to Role B instead of Role A.

Is it possible to do this? I was thinking of creating a writeable clone, then using something like CurrentPage.ACL.UpdatePermissions("Role B"); (Though that function is made up!).

Is there anything that allows this?

Thanks in advance for any help!

Karl.

#47537
Feb 01, 2011 15:33
Vote:
 

AccessControlList is IEnumerable so it contains a number of AccessControlEntries (which isn't obvious, I know). So basically you could loop over the parent page's ACL and copy the entries to the moved page (after calling CreateWriteableClone on it and clearing it). You can also copy the whole ACL (Copy() method) and set it in the moved page, replacing the current ACL. I don't know if that will work though, but when copying a page that is how it is done internally (of course then the copy is a new page which doesn't yet have an ACL).

#47538
Feb 01, 2011 15:53