AI OnAI Off
You need to add the role but with AccessLevel.NoAccess. It took me some time before I understood that myself :)
PageAccessControlList acl = new PageAccessControlList(pageRef);
acl.Add(new AccessControlEntry(EPiServer.Security.EveryoneRole.RoleName, AccessLevel.NoAccess, SecurityEntityType.Role));
acl.Save();
Hi Anders,
Many thanks for that, did the trick nicely. One point to note that I had to remove the acl entry prior to adding again with NoAccess as it complained that the entry already existed (fair enough I suppose). It's strange that the Remove method doesn't persist even when you save the list!!
Thanks again,
Mark
Could it be that if you just remove Everyone it will inherit Everyone's access righs from the parent? So you have to explicitly add the NoAccess to state that you do not want it to inherit?
Hello,
I'm trying to remove groups from CMS pages in the code behind and nothing I have tried seems to be working. Does anybody have an hints, tips or samples of how to do this?
Thanks in advance,
Mark