public class ApiPermissionFilter : ActionFilterAttribute
{
#region 属性
/// <summary>
/// 数据权限编码
/// </summary>
public string Code
{ get; set; }
#endregion
public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
{
UserInfo service = new UserInfo();
try
{
if (!service.IsInPermission(Code))
{
actionContext.Response = new HttpResponseMessage(HttpStatusCode.Forbidden);
}
}
catch (Exception ex)
{
SmartCardCommon.LogHelper.WriteErrorLog(ex.Message, ex);
throw ex;
}
finally
{
SmartCardCommon.NhibernaterSessionHelper.CloseSession();
}
}
}
{
#region 属性
/// <summary>
/// 数据权限编码
/// </summary>
public string Code
{ get; set; }
#endregion
public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
{
UserInfo service = new UserInfo();
try
{
if (!service.IsInPermission(Code))
{
actionContext.Response = new HttpResponseMessage(HttpStatusCode.Forbidden);
}
}
catch (Exception ex)
{
SmartCardCommon.LogHelper.WriteErrorLog(ex.Message, ex);
throw ex;
}
finally
{
SmartCardCommon.NhibernaterSessionHelper.CloseSession();
}
}
}