コード例 #1
0
 public LoginController(IServiceProvider service)
 {
     _userApp      = service.GetRequiredService <SysUserAppService>();
     _roleApp      = service.GetRequiredService <SysRoleAppService>();
     RequestHelper = service.GetRequiredService <IAtlassRequest>();
     loginInfoApp  = service.GetRequiredService <LoginInfoAppService>();
 }
コード例 #2
0
 public SystemMonitorController(IAtlassRequest atlassRequest)
 {
     RequestHelper = atlassRequest;
     if (Runtime.Windows)
     {
         _machineInfo = new WindowsMachineInfo();
     }
     else
     {
         _machineInfo = new LinuxMachineInfo();
     }
 }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
 public IPFilterAttribute(IAtlassRequest atlassReuqest)
 {
     RequestHelper = atlassReuqest;
 }
コード例 #5
0
 public BdUploadController(IAtlassRequest atlassReuqest)
 {
     RequestHelper = atlassReuqest;
 }
コード例 #6
0
 public AtlassActionFilterAttribute(IAtlassRequest atlassReuqest)
 {
     RequestHelper = atlassReuqest;
 }
コード例 #7
0
 public SystemMonitorController(IAtlassRequest atlassRequest, IMachineInfo machineInfo)
 {
     RequestHelper = atlassRequest;
     _machineInfo  = machineInfo;
 }
コード例 #8
0
 public UploadController(IAtlassRequest requestHelper)
 {
     RequestHelper = requestHelper;
 }
コード例 #9
0
 public HomeController(IOptions <SenparcWeixinSetting> senparcWeixinSetting, IAtlassRequest requestHelper)
 {
     _wxSetting    = senparcWeixinSetting.Value;
     RequestHelper = requestHelper;
 }
コード例 #10
0
 public AtlassAuthorizationAttribute(IAtlassRequest atlassReuqest)
 {
     RequestHelper = atlassReuqest;
 }
コード例 #11
0
ファイル: lOGINController.cs プロジェクト: zt405368/EasyCMS
 public LoginController(SysUserAppService userApp, IAtlassRequest AtlassRequestHelper)
 {
     _userApp      = userApp;
     RequestHelper = AtlassRequestHelper;
 }