添加项目文件。

This commit is contained in:
dell
2023-03-03 16:07:50 +08:00
parent 2c462551b6
commit 011039960e
585 changed files with 362460 additions and 0 deletions

View File

@ -0,0 +1,32 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace HT.Cloud.Code
{
/// <summary>
/// 管理员特性MVC使用
/// </summary>
public class HandlerAdminAttribute : ActionFilterAttribute
{
private readonly bool _isSuper;
public HandlerAdminAttribute(bool isSuper = true)
{
_isSuper = isSuper;
}
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (OperatorProvider.Provider.GetCurrent() != null && _isSuper == true ? OperatorProvider.Provider.GetCurrent().IsSuperAdmin : OperatorProvider.Provider.GetCurrent().IsAdmin)
{
return;
}
else
{
//filterContext.HttpContext.Response.WriteAsync("<script>top.location.href ='" + filterContext.HttpContext.Request.PathBase + "/Home/Error?msg=403" + "';if(document.all) window.event.returnValue = false;</script>");
filterContext.Result = new RedirectResult(filterContext.HttpContext.Request.PathBase + "/Home/Error?msg=403");
return;
}
}
}
}