public async Task <LoginInformationDto> GetCurrentLoginInformations() { var output = new LoginInformationDto { Application = new ApplicationInfoDto { Version = AppVersionHelper.Version, ReleaseDate = AppVersionHelper.ReleaseDate, Features = new Dictionary <string, bool> { //{ "SignalR", SignalRFeature.IsAvailable }, //{ "SignalR.AspNetCore", SignalRFeature.IsAspNetCore } } } }; if (AbpSession.UserId.HasValue) { var user = await GetCurrentUserAsync(); output.User = ObjectMapper.Map <UserLoginInfoDto>(user); //获取用户的角色 var roleNameList = await Resolve <UserManager>().GetRolesAsync(user); //var roleNameList = (from userrole in _userRoleRepository.GetAll() // join u in _userRoleRepository.GetAll() on userrole.UserId equals u.Id // join role in _roleRepository.GetAll() on userrole.RoleId equals role.Id // where u.Id == user.Id // select new { role.DisplayName ,role.Name}).ToList(); output.User.RoleNames = roleNameList.Select(o => o.Name).ToList(); output.User.RoleDisplayNames = roleNameList.Select(o => o.DisplayName).ToList(); } return(output); }
public async Task <IViewComponentResult> InvokeAsync(LoginInformationDto loginInformationDto) { //var userMenus = await _menuManager.LoadUserMenu(_abpSession.ToUserIdentifier()); //var userMenus = await _menuAppService.GetUserMenu(_abpSession.ToUserIdentifier()); //var mainMenu = await _userNavigationManager.GetMenuAsync("MainMenu", _abpSession.ToUserIdentifier()); return(View(loginInformationDto)); }
public async Task <LoginInformationDto> GetCurrentLoginInformations() { var output = new LoginInformationDto { Application = new ApplicationInfoDto { Version = AppVersionHelper.Version, ReleaseDate = AppVersionHelper.ReleaseDate, Features = new Dictionary <string, bool> { //{ "SignalR", SignalRFeature.IsAvailable }, //{ "SignalR.AspNetCore", SignalRFeature.IsAspNetCore } } } }; if (AbpSession.TenantId.HasValue) { var tenant = await GetCurrentTenantAsync(); output.Tenant = ObjectMapper.Map <TenantLoginInfoDto>(tenant); output.Tenant.EditionName = tenant.EditionId == null?L("试用版") : tenant.Edition.DisplayName; output.Tenant.ExpireDate = tenant.GetPropertyValue <DateTime?>("ExpireDate")?.ToString("yyyy-MM-dd"); } if (AbpSession.UserId.HasValue) { var user = await GetCurrentUserAsync(); output.User = ObjectMapper.Map <UserLoginInfoDto>(user); //获取用户的角色 //var roleNameList = (from userrole in _userRoleRepository.GetAll() // join role in _roleRepository.GetAll() on userrole.RoleId equals role.Id // where userrole.UserId == user.Id // select new { role.DisplayName ,role.Name}).ToList(); //output.User.RoleNames = roleNameList.Select(o=>o.Name).ToList(); //output.User.RoleDisplayNames = roleNameList.Select(o => o.DisplayName).ToList(); //获取用户部门 //var staff = await _staffRepository.FirstOrDefaultAsync(o => o.UserId == user.Id); //if (staff != null) //{ // var departQuery = from uou in _staffOrganizationUnitRepository.GetAll() // join s in _staffRepository.GetAll() on uou.StaffId equals s.Id // join ou in _organizationUnitRepository.GetAll() on uou.OrganizationUnitId equals ou.Id // where s.Id == staff.Id // select ou.DisplayName; // output.User.DepartNames = departQuery.ToList(); //} } return(output); }