1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 00:22:50 -05:00

[BEEEP] begin 2fa integration tests for identity (#3843)

* begin 2fa integration tests for identity
- fix org mappings and query

* add key length to doc

* lint
This commit is contained in:
Jake Fink
2024-04-05 09:30:42 -04:00
committed by GitHub
parent 4af7780bb8
commit 108d22f484
4 changed files with 169 additions and 5 deletions

View File

@ -26,7 +26,20 @@ public class OrganizationMapperProfile : Profile
{
public OrganizationMapperProfile()
{
CreateMap<Core.AdminConsole.Entities.Organization, Organization>().ReverseMap();
CreateMap<Core.AdminConsole.Entities.Organization, Organization>()
.ForMember(org => org.Ciphers, opt => opt.Ignore())
.ForMember(org => org.OrganizationUsers, opt => opt.Ignore())
.ForMember(org => org.Groups, opt => opt.Ignore())
.ForMember(org => org.Policies, opt => opt.Ignore())
.ForMember(org => org.Collections, opt => opt.Ignore())
.ForMember(org => org.SsoConfigs, opt => opt.Ignore())
.ForMember(org => org.SsoUsers, opt => opt.Ignore())
.ForMember(org => org.Transactions, opt => opt.Ignore())
.ForMember(org => org.ApiKeys, opt => opt.Ignore())
.ForMember(org => org.Connections, opt => opt.Ignore())
.ForMember(org => org.Domains, opt => opt.Ignore())
.ReverseMap();
CreateProjection<Organization, SelfHostedOrganizationDetails>()
.ForMember(sd => sd.CollectionCount, opt => opt.MapFrom(o => o.Collections.Count))
.ForMember(sd => sd.GroupCount, opt => opt.MapFrom(o => o.Groups.Count))

View File

@ -50,9 +50,10 @@ public class OrganizationRepository : Repository<Core.AdminConsole.Entities.Orga
{
var dbContext = GetDatabaseContext(scope);
var organizations = await GetDbSet(dbContext)
.Select(e => e.OrganizationUsers
.Where(ou => ou.UserId == userId)
.Select(ou => ou.Organization))
.SelectMany(e => e.OrganizationUsers
.Where(ou => ou.UserId == userId))
.Include(ou => ou.Organization)
.Select(ou => ou.Organization)
.ToListAsync();
return Mapper.Map<List<Core.AdminConsole.Entities.Organization>>(organizations);
}