Exemplo n.º 1
0
        //查询
        public async Task <Admin> CheckAdmin(AdminLoginModel AdminLogin, basisContext _context)
        {
            var entity = new Admin {
                UserName = AdminLogin.UserName, Password = AdminLogin.Password
            };
            var items = await _context.Admins.Where(a => a.UserName == entity.UserName && a.Password == entity.Password).SingleOrDefaultAsync();

            //await _context.AdminScopes.Where(a => a.Identifier == items.AdminScopeIdentifier).SingleOrDefaultAsync();
            return(items);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 public LoginController(basisContext context, IMemoryCache cache)
 {
     _context = context;
     _cache   = cache;
 }
Exemplo n.º 4
0
 public ProjectController(basisContext context, IMemoryCache cache)
 {
     _context = context;
     _cache   = cache;
 }
Exemplo n.º 5
0
 public TestMain(basisContext context, IMemoryCache cache)
 {
     _context = context;
     _cache   = cache;
 }