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

AC Team code ownership moves: Organization pt. 1 (#3472)

* move Organization.cs files to AC Team code ownership
This commit is contained in:
Thomas Rittson
2023-11-29 09:18:08 +10:00
committed by GitHub
parent 492298442d
commit 9021236d61
167 changed files with 222 additions and 164 deletions

View File

@ -1,13 +1,13 @@
using AutoMapper;
using Bit.Core.Enums;
using Bit.Core.Models.Data.Organizations;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
using Bit.Infrastructure.EntityFramework.Auth.Models;
using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.Vault.Models;
namespace Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.AdminConsole.Models;
public class Organization : Core.Entities.Organization
public class Organization : Core.AdminConsole.Entities.Organization
{
public virtual ICollection<Cipher> Ciphers { get; set; }
public virtual ICollection<OrganizationUser> OrganizationUsers { get; set; }
@ -26,7 +26,7 @@ public class OrganizationMapperProfile : Profile
{
public OrganizationMapperProfile()
{
CreateMap<Core.Entities.Organization, Organization>().ReverseMap();
CreateMap<Core.AdminConsole.Entities.Organization, Organization>().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

@ -1,5 +1,4 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.AdminConsole.Models;

View File

@ -1,5 +1,4 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider;

View File

@ -1,5 +1,6 @@
using AutoMapper;
using Bit.Core.Auth.Models.Data;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.Auth.Models;

View File

@ -1,5 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Auth.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.Auth.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Models;

View File

@ -1,6 +1,6 @@
using System.Text.Json;
using AutoMapper;
using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
using Bit.Infrastructure.EntityFramework.Repositories.Queries;
using LinqToDB.Data;
using Microsoft.EntityFrameworkCore;

View File

@ -5,17 +5,17 @@ using Bit.Core.Models.Data.Organizations;
using Bit.Core.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Organization = Bit.Infrastructure.EntityFramework.Models.Organization;
using Organization = Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization;
namespace Bit.Infrastructure.EntityFramework.Repositories;
public class OrganizationRepository : Repository<Core.Entities.Organization, Organization, Guid>, IOrganizationRepository
public class OrganizationRepository : Repository<Core.AdminConsole.Entities.Organization, Organization, Guid>, IOrganizationRepository
{
public OrganizationRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Organizations)
{ }
public async Task<Core.Entities.Organization> GetByIdentifierAsync(string identifier)
public async Task<Core.AdminConsole.Entities.Organization> GetByIdentifierAsync(string identifier)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
@ -26,17 +26,17 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
}
}
public async Task<ICollection<Core.Entities.Organization>> GetManyByEnabledAsync()
public async Task<ICollection<Core.AdminConsole.Entities.Organization>> GetManyByEnabledAsync()
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var organizations = await GetDbSet(dbContext).Where(e => e.Enabled).ToListAsync();
return Mapper.Map<List<Core.Entities.Organization>>(organizations);
return Mapper.Map<List<Core.AdminConsole.Entities.Organization>>(organizations);
}
}
public async Task<ICollection<Core.Entities.Organization>> GetManyByUserIdAsync(Guid userId)
public async Task<ICollection<Core.AdminConsole.Entities.Organization>> GetManyByUserIdAsync(Guid userId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
@ -46,11 +46,11 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
.Where(ou => ou.UserId == userId)
.Select(ou => ou.Organization))
.ToListAsync();
return Mapper.Map<List<Core.Entities.Organization>>(organizations);
return Mapper.Map<List<Core.AdminConsole.Entities.Organization>>(organizations);
}
}
public async Task<ICollection<Core.Entities.Organization>> SearchAsync(string name, string userEmail,
public async Task<ICollection<Core.AdminConsole.Entities.Organization>> SearchAsync(string name, string userEmail,
bool? paid, int skip, int take)
{
using (var scope = ServiceScopeFactory.CreateScope())
@ -65,7 +65,7 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
.OrderBy(e => e.CreationDate)
.Skip(skip).Take(take)
.ToListAsync();
return Mapper.Map<List<Core.Entities.Organization>>(organizations);
return Mapper.Map<List<Core.AdminConsole.Entities.Organization>>(organizations);
}
}
@ -93,7 +93,7 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
}
}
public async Task<ICollection<Core.Entities.Organization>> SearchUnassignedToProviderAsync(string name, string ownerEmail, int skip, int take)
public async Task<ICollection<Core.AdminConsole.Entities.Organization>> SearchUnassignedToProviderAsync(string name, string ownerEmail, int skip, int take)
{
using var scope = ServiceScopeFactory.CreateScope();
@ -145,7 +145,7 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
await OrganizationUpdateStorage(id);
}
public override async Task DeleteAsync(Core.Entities.Organization organization)
public override async Task DeleteAsync(Core.AdminConsole.Entities.Organization organization)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
@ -205,7 +205,7 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
}
}
public async Task<Core.Entities.Organization> GetByLicenseKeyAsync(string licenseKey)
public async Task<Core.AdminConsole.Entities.Organization> GetByLicenseKeyAsync(string licenseKey)
{
using (var scope = ServiceScopeFactory.CreateScope())
{

View File

@ -1,5 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models;

View File

@ -1,5 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models;

View File

@ -1,5 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
namespace Bit.Infrastructure.EntityFramework.Models;

View File

@ -1,4 +1,5 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.Vault.Models;