29 lines
821 B
C#
29 lines
821 B
C#
using System.Web.Mvc;
|
|
using Audit.Mvc;
|
|
using EnVisage.Code.Audit.Configuration;
|
|
|
|
namespace EnVisage.Code.Audit.Attributes
|
|
{
|
|
public class PrevuAuditAttribute: AuditAttribute
|
|
{
|
|
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
|
{
|
|
var actionName = filterContext.ActionDescriptor?.ActionName;
|
|
var controllerName = filterContext.ActionDescriptor?.ControllerDescriptor?.ControllerName;
|
|
var configuration = AuditConfigurationSection.Current;
|
|
if (!string.IsNullOrEmpty(actionName) && !string.IsNullOrEmpty(controllerName))
|
|
{
|
|
foreach (ControllerElement path in configuration.Paths)
|
|
{
|
|
if (path.Path == controllerName || path.Path == controllerName + "/" + actionName)
|
|
{
|
|
base.OnActionExecuting(filterContext);
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
} |