Problem with saving a ContentAccessControlList.

Vote:
 

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]

#186482
Edited, Dec 20, 2017 14:44
Vote:
 

which epi version are you on?

#186501
Dec 21, 2017 0:19
Vote:
 

Im currently on version 10.10.

#186505
Dec 21, 2017 8:17
Vote:
 

You can update acl:s through EPiServer.DataAbstraction.IContentSecurityRepository.Save, the instance of IContentSecurityRepository can be retreived from IOC container 

#186898
Jan 08, 2018 13:43
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.