London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
You can use (i.e. listen to)
You can hook in to the IActivityEvents event for ActivityCreated and when the Save button is clicked it will trigger and provide info on the changed type.
You may have to figure out some code to detect that it's a change to the ACL but here's at least the start / answer to the event question that hopefully helps
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.DataAbstraction.Activities;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
namespace TmxEpi.Ecommerce.Storefront.Site.Infrastructure.Initialization
{
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class ContentInitializationModule : IConfigurableModule
{
private static IContentTypeRepository _contentTypeRepository;
private static IActivityEvents _activityEvents;
public void Initialize(InitializationEngine context)
{
_activityEvents = context.Locate.Advanced.GetInstance<IActivityEvents>();
_contentTypeRepository = context.Locate.Advanced.GetInstance<IContentTypeRepository>();
_activityEvents.ActivityCreated += _activityEvents_ActivityCreated;
}
private void _activityEvents_ActivityCreated(object sender, ActivityCreatedEventArgs e)
{
if (e.Activity is ContentTypeActivity contentTypeActivity)
{
var contentType = _contentTypeRepository.Load(contentTypeActivity.ContentTypeGuid);
}
}
}
}
Hi,
Is there an event for capturing changes to content type access level?
Something similar to IContentSecurityRepository ContentSecuritySaved event, but for content types.
Thanks.