kreta/KretaWeb/Security/MvcCsokkentettGondviseloAccessAttribute.cs
2024-03-13 00:33:46 +01:00

25 lines
890 B
C#

using System.Net;
using System.Web;
using System.Web.Mvc;
using Kreta.BusinessLogic.Helpers.SystemSettings;
using Kreta.Web.Helpers;
namespace Kreta.Web.Security
{
public class MvcCsokkentettGondviseloAccessAttribute : ActionFilterAttribute
{
public MvcCsokkentettGondviseloAccessAttribute() { }
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
var result = new SystemSettingsHelper(ConnectionTypeExtensions.GetOrganizationConnectionType()).GetSystemSettingValue<bool>(Enums.RendszerBeallitasTipusEnum.Csokkentett_gondviselok_kezelese);
if (!result)
{
filterContext.Result = new EmptyResult();
HttpContext.Current.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
HttpContext.Current.Response.End();
}
}
}
}