示例#1
0
        public static List <AuthorizedUser> GetAuthorized(string terminal)
        {
            var pKey = PrimaryCacheKey(terminal);
            var sKey = SecondaryCacheKey(terminal);

            var flag = DateTime.Now.Add(-AuthenticationExpiration);

            return(mongo.AnyCollection <UserAuthentication>(CacheKey).AsQueryable().Where(x => x.CreatedTime >= flag && (x.UniqueId == pKey || x.UniqueId == sKey))
                   .Select(x => new AuthorizedUser
            {
                UserId = x.User.LoginId,
                UserName = x.User.DisplayName,
                Kernel = x.User.Kernel,
                Token = x.User.Token,
                DefaultMenu = x.User.DefaultMenu,
            }).ToList());
        }