Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
I need to index the child pages when an editor changes the restrictions in a page in CMS.
So, I have handled the ContentSecuritySaved event like below to index all the child pages.
[InitializableModule] public class SecurityEventInitializationModule : IInitializableModule { public void Initialize(InitializationEngine context) { var secRepos = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentSecurityRepository>(); secRepos.ContentSecuritySaved += secRepos_ContentSecuritySaved; } public void Preload(string[] parameters) { } public void Uninitialize(InitializationEngine context) { var secRepos = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentSecurityRepository>(); secRepos.ContentSecuritySaved -= secRepos_ContentSecuritySaved; } void secRepos_ContentSecuritySaved(object sender, ContentSecurityEventArg e) { List<IContent> childPages = GetAllChildren(e.ContentLink); // Index all child pages IContentIndexer indexer = ContentIndexer.Instance; indexer.Index(childPages); } }
It indexes the child pages, but it does not correctly update the restrictions in the index (EPiServer.Find.Cms.ContentExtensions.RolesWithReadAccess property).
In the Find index, The child pages always have the previous restrictions we have defined.
How to have the current restrictions in the Find index ?
More Info on my setup:
All the child pages inherit the settings from parents.