2021-11-22 14:29:22 +01:00
|
|
|
using Microsoft.AspNetCore.Mvc.Filters;
|
|
|
|
|
|
2021-11-29 18:25:50 +01:00
|
|
|
namespace zero.Api.Controllers;
|
2021-11-22 14:29:22 +01:00
|
|
|
|
|
|
|
|
public class BackofficeFilterAttribute : IActionFilter
|
|
|
|
|
{
|
|
|
|
|
const string SCOPE_KEY = "scope";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void OnActionExecuting(ActionExecutingContext context)
|
|
|
|
|
{
|
|
|
|
|
Type type = context.Controller.GetType();
|
|
|
|
|
|
2021-11-29 18:25:50 +01:00
|
|
|
if (typeof(ZeroApiController).IsAssignableFrom(type))
|
2021-11-22 14:29:22 +01:00
|
|
|
{
|
|
|
|
|
if (context.HttpContext.Request.Query.TryGetValue(SCOPE_KEY, out var scope))
|
|
|
|
|
{
|
2021-11-27 16:33:05 +01:00
|
|
|
//(context.Controller as ZeroBackofficeController).OnScopeChanged(scope.ToString());
|
2021-11-22 14:29:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnActionExecuted(ActionExecutedContext context)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|