예제 #1
0
        /// <summary>
        /// 获取Redis中的Session信息
        /// </summary>
        /// <returns></returns>
        private static SessionModel GetSessionKey()
        {
            string useriD = GetSessionID();

            if (string.IsNullOrEmpty(useriD))
            {
                return(null);
            }
            var model = RedisSession.Get <SessionModel>(useriD);

            return(model);
        }
예제 #2
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            RedisSession redisSession = new RedisSession(HttpContext.Current);
            var          user         = redisSession.Get <Administrator>("ADMINUSER");

            if (user != null)
            {
                if (Code != null)
                {
                    var  adminService = Container.Instance.Resolve <IAdministratorService>();
                    bool pass         = adminService.IsAuthorizePass(user.RoleId, Code);
                    return(pass);
                }
                return(true);
            }
            return(false);
        }