public LoginController(IServiceProvider service) { _userApp = service.GetRequiredService <SysUserAppService>(); _roleApp = service.GetRequiredService <SysRoleAppService>(); RequestHelper = service.GetRequiredService <IAtlassRequest>(); loginInfoApp = service.GetRequiredService <LoginInfoAppService>(); }
public SystemMonitorController(IAtlassRequest atlassRequest) { RequestHelper = atlassRequest; if (Runtime.Windows) { _machineInfo = new WindowsMachineInfo(); } else { _machineInfo = new LinuxMachineInfo(); } }
/// <summary> /// 执行前 /// </summary> /// <param name="filterContext"></param> /// <param name="next"></param> /// <returns></returns> public override async Task OnActionExecutionAsync(ActionExecutingContext filterContext, ActionExecutionDelegate next) { //if (!ValidateToken(filterContext.HttpContext.Request.Headers["token"])) //{ // filterContext.Result = new UnauthorizedResult(); //} //记录路由日志 //IDictionary<string, string> RouteValues = filterContext.ActionDescriptor.RouteValues; //string route = GetRouteInfo(RouteValues); //LoggerHelper.Info(route,"路由记录"); IAtlassRequest requestHelper = GetAtlassRequest(); var user = requestHelper.AdminInfo(); if (user == null) { //ajax请求打回 if (requestHelper.IsAjax()) { var result = new ResultAdaptDto(); result.message = "用户信息已过期,请重新登录"; result.status = false; result.statusCode = 403; filterContext.Result = new JsonResult(result); return; } else { filterContext.Result = new RedirectResult("~/Login/index"); return; } } else { if (GlobalContext.RuntimeEnvironment == 0 && requestHelper.IsAjax()) { if (PermissionTag.Contains("delete") || PermissionTag.Contains("clear")) { var result = new ResultAdaptDto(); result.message = "演示模式,禁止删除"; result.status = false; result.statusCode = 401; filterContext.Result = new JsonResult(result); return; } } //#只判断是否登录,不判断具体权限 if (PermissionTag != "#" && !user.IsSuper) { var roleApp = GetRoleAppService(); bool hasPermission = roleApp.HasPermission(user.RoleId, PermissionTag); if (!hasPermission) { //ajax请求打回 if (requestHelper.IsAjax()) { var result = new ResultAdaptDto(); result.message = "抱歉,没有操作权限"; result.status = false; result.statusCode = 401; filterContext.Result = new JsonResult(result); return; } else { filterContext.Result = new RedirectResult("~/Login/NoPermission"); return; } } } } await base.OnActionExecutionAsync(filterContext, next); }
public IPFilterAttribute(IAtlassRequest atlassReuqest) { RequestHelper = atlassReuqest; }
public BdUploadController(IAtlassRequest atlassReuqest) { RequestHelper = atlassReuqest; }
public AtlassActionFilterAttribute(IAtlassRequest atlassReuqest) { RequestHelper = atlassReuqest; }
public SystemMonitorController(IAtlassRequest atlassRequest, IMachineInfo machineInfo) { RequestHelper = atlassRequest; _machineInfo = machineInfo; }
public UploadController(IAtlassRequest requestHelper) { RequestHelper = requestHelper; }
public HomeController(IOptions <SenparcWeixinSetting> senparcWeixinSetting, IAtlassRequest requestHelper) { _wxSetting = senparcWeixinSetting.Value; RequestHelper = requestHelper; }
public AtlassAuthorizationAttribute(IAtlassRequest atlassReuqest) { RequestHelper = atlassReuqest; }
public LoginController(SysUserAppService userApp, IAtlassRequest AtlassRequestHelper) { _userApp = userApp; RequestHelper = AtlassRequestHelper; }