Пример #1
0
        public Resp_Index <SysUserDTO> Index(Req_Index request)
        {
            var response = new Resp_Index <SysUserDTO>();
            var limits   = _sysRightRepository.GetRightByUserWithModule(request.userId, request.moduleId).ConvertoDto <SysUserRightView, SysModuleOperateIndexDTO>().ToList();

            if (limits.IsNotNull() && limits.Count > 0 && limits.Find(s => s.IsValid == 1).IsNotNull())
            {
                response.allowVisit      = true;
                response.moduleOperaties = limits.OrderByDescending(t => t.IsValid).GroupBy(t => new { t.KeyCode, t.KeyName }).Select(s => new SysModuleOperateIndexDTO
                {
                    KeyCode = s.Key.KeyCode,
                    KeyName = s.Key.KeyName,
                    IsValid = s.Sum(x => x.IsValid),
                }).ToList();
                var query_parameter = new SysUser_Query {
                    PgIndex = 1, PgSize = request.PgSize
                };
                response.query = Query(query_parameter);
            }
            else
            {
                _sysRightRepository.UnitOfWork.Commite();
                response.allowVisit = false;
                response.message    = "无访问权限,请联系管理员";
            }

            return(response);
        }
Пример #2
0
        public Resp_RightOperator_Index Index(Req_Index request)
        {
            var response = new Resp_RightOperator_Index();
            var limits   = _sysRightRepository.GetRightByUserWithModule(request.userId, request.moduleId).ConvertoDto <SysUserRightView, SysModuleOperateIndexDTO>().ToList();

            if (!limits.IsNullOrEmpty() && limits.Find(s => s.IsValid == 1).IsNotNull())
            {
                response.allowVisit      = true;
                response.moduleOperaties = limits.OrderByDescending(t => t.IsValid).GroupBy(t => new { t.KeyCode, t.KeyName }).Select(s => new SysModuleOperateIndexDTO
                {
                    KeyCode = s.Key.KeyCode,
                    KeyName = s.Key.KeyName,
                    IsValid = s.Sum(x => x.IsValid),
                }).ToList();
                using (var context = new SKContext())
                {
                    response.sysRoles   = context.SysRoles.ToList().ConvertoDto <SysRole, SysRoleDTO>().ToList();
                    response.sysModules = context.SysModules.Where(t => t.SuperSysModule == null).ToList().ConvertoDto <SysModule, SysModuleDTO>().ToList();
                }
            }
            else
            {
                _sysRightRepository.UnitOfWork.Commite();
                response.allowVisit = false;
                response.message    = "无访问权限,请联系管理员";
            }

            return(response);
        }