Example #1
0
        //获取所有用户对应的信息
        public static AdminInfoModel getUserInfo(IMemoryCache _cache, string token, basisContext _context)
        {
            string a = _cache.Get <string>(token);
            //获取当前用户
            Admin admin = ConvertJson.JsonStringToObj <Admin>(a);
            //获取当前用户权限
            var adminscope = _context.AdminScopes.Where(sa => sa.Identifier == admin.AdminScopeIdentifier).SingleOrDefault();

            AdminInfoModel user = new AdminInfoModel
            {
                Id                   = admin.Id,
                RealName             = admin.RealName,
                UserName             = admin.UserName,
                AdminScopeIdentifier = admin.AdminScopeIdentifier,
                OneLevelScopeName    = adminscope.OneLevelScopeName,
                TwoLevelScopeName    = adminscope.TwoLevelScopeName,
                OneLevelScopeId      = adminscope.OneLevelScopeId,
                TwoLevelScopeId      = adminscope.TwoLevelScopeId
            };

            return(user);
        }