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]
which epi version are you on?
Im currently on version 10.10.
You can update acl:s through EPiServer.DataAbstraction.IContentSecurityRepository.Save, the instance of IContentSecurityRepository can be retreived from IOC container
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:
I have also tried using pageAccessControlList.Save(SecuritySaveType.Replace);.
Happy if anyone can point me in the right direction :)
[Pasting files is not allowed]