26 lines
626 B
C#
26 lines
626 B
C#
using Microsoft.AspNetCore.Mvc.Filters;
|
|
|
|
namespace zero.Api.Controllers;
|
|
|
|
public class BackofficeFilterAttribute : IActionFilter
|
|
{
|
|
const string SCOPE_KEY = "scope";
|
|
|
|
|
|
public void OnActionExecuting(ActionExecutingContext context)
|
|
{
|
|
Type type = context.Controller.GetType();
|
|
|
|
if (typeof(ZeroApiController).IsAssignableFrom(type))
|
|
{
|
|
if (context.HttpContext.Request.Query.TryGetValue(SCOPE_KEY, out var scope))
|
|
{
|
|
//(context.Controller as ZeroBackofficeController).OnScopeChanged(scope.ToString());
|
|
}
|
|
}
|
|
}
|
|
|
|
public void OnActionExecuted(ActionExecutedContext context)
|
|
{
|
|
}
|
|
} |