November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
You should be able to get hold of the interface implementation from IOC container (e.g. ServiceLocator.Current.GetInstance<IContentSecurityRepository>). It is singleton scoped. A typical usage would be to have an InitializableModule (with a DependecyModule attribute to EPiServer.Web.InitiailizationModule) where you would hook up your eventhandler. The event will be raised whenever access right is changed for a content item.
Thanks Johan. Works perfectly, example below:
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
[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)
{
//todo: implement
}
}
Hi,
The IContentSecurityRepository interface defines the ContentSecuritySaved event:
http://world.episerver.com/Documentation/Class-library/?documentId=cms/7.5/6a3b465b-0d98-387f-66b8-1b28132e1b7c
Where is this interface implemented and how can it be consumed?
Thanks