using Bootstrap.Security; using MongoDB.Driver; using System; using System.Collections.Generic; namespace Bootstrap.Client.DataAccess.MongoDB { /// /// 用户表实体类 /// public class User : DataAccess.User { /// /// 获得/设置 用户主键ID /// public string Id { get; set; } /// /// 获得/设置 用户被批复时间 /// public DateTime? ApprovedTime { get; set; } /// /// /// public IEnumerable Roles { get; set; } /// /// /// public IEnumerable Groups { get; set; } /// /// /// /// /// public override BootstrapUser RetrieveUserByUserName(string userName) { var project = Builders.Projection.Include(u => u.Id) .Include(u => u.UserName) .Include(u => u.DisplayName) .Include(u => u.Icon) .Include(u => u.Css) .Include(u => u.App); var ret = DbManager.Users.Find(user => user.UserName.ToLowerInvariant() == userName.ToLowerInvariant()).Project(project).FirstOrDefault(); if (ret != null) { if (string.IsNullOrEmpty(ret.Icon)) ret.Icon = "default.jpg"; if (string.IsNullOrEmpty(ret.App)) ret.App = "0"; } return ret; } } }