Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Problem with saving a ContentAccessControlList.

$
0
0

Hi!

I have a problem with saving a ContentAccessControlList. 

When i create a specific pagetype i want to programatically create a set of containers and subpages and set their access rights. 

Creating a page and its subpages/containers works fine but when i try to set the access rights for each subpage i get this error when i try to save.

System.NotSupportedException: 'Specified method is not supported.'

The Code:

public static void SetAccessRightsForPongChildPages(PageData page, string productCode = null)
{
var pageAccessControlList = new ContentAccessControlList(page.PageLink)
{
new AccessControlEntry("Administrators", AccessLevel.FullAccess, SecurityEntityType.Role),
new AccessControlEntry(ConfigurationManager.AppSettings["EPiRoleAdmin"], AccessLevel.FullAccess, SecurityEntityType.Role)
};
if (page is ContainerBasePage)
{
pageAccessControlList.Add(new AccessControlEntry("Everyone", AccessLevel.Read, SecurityEntityType.Role));
}
if (productCode != null)
{       pageAccessControlList.Add(new AccessControlEntry(ConfigurationManager.AppSettings["EPiRoleProdOwnerBase"] + productCode,       AccessLevel.FullAccess & ~AccessLevel.Administer & ~AccessLevel.Publish, SecurityEntityType.Role));
}
pageAccessControlList.Save();
}



I have also tried using pageAccessControlList.Save(SecuritySaveType.Replace);. 

Happy if anyone can point me in the right direction :)

[Pasting files is not allowed]


Viewing all articles
Browse latest Browse all 9076

Trending Articles