1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

[AC-1750] AC Team code ownership moves - Groups (#3358)

This commit is contained in:
Thomas Rittson 2023-10-20 06:37:46 +10:00 committed by GitHub
parent dd8ffa2cbc
commit c1cf07d764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
72 changed files with 192 additions and 124 deletions

View File

@ -1,4 +1,5 @@
using Bit.Core.Context;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Enums;
using Bit.Core.Repositories;
using Bit.Core.SecretsManager.AuthorizationRequirements;

View File

@ -1,6 +1,7 @@
using Bit.Core.Enums;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Scim.Groups.Interfaces;
using Bit.Scim.Models;

View File

@ -1,5 +1,5 @@
using Bit.Core.Entities;
using Bit.Core.Repositories;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Scim.Groups.Interfaces;
namespace Bit.Scim.Groups;

View File

@ -1,4 +1,4 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
namespace Bit.Scim.Groups.Interfaces;

View File

@ -1,4 +1,5 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Scim.Models;
namespace Bit.Scim.Groups.Interfaces;

View File

@ -1,4 +1,5 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Scim.Models;
namespace Bit.Scim.Groups.Interfaces;

View File

@ -1,10 +1,10 @@
using System.Text.Json;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.AdminConsole.Services;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Core.Services;
using Bit.Scim.Groups.Interfaces;
using Bit.Scim.Models;

View File

@ -1,8 +1,10 @@
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Scim.Context;
using Bit.Scim.Groups.Interfaces;

View File

@ -1,9 +1,10 @@
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Scim.Context;
using Bit.Scim.Groups.Interfaces;
using Bit.Scim.Models;

View File

@ -1,4 +1,4 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Utilities;
namespace Bit.Scim.Models;

View File

@ -1,4 +1,4 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
namespace Bit.Scim.Models;

View File

@ -2,6 +2,8 @@
using System.Security.Claims;
using Bit.Commercial.Core.SecretsManager.AuthorizationHandlers.AccessPolicies;
using Bit.Commercial.Core.Test.SecretsManager.Enums;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;

View File

@ -1,5 +1,5 @@
using Bit.Core.Entities;
using Bit.Core.Repositories;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Scim.Groups;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;

View File

@ -1,10 +1,11 @@
using System.Text.Json;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.AdminConsole.Services;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Core.Services;
using Bit.Scim.Groups;
using Bit.Scim.Models;
using Bit.Scim.Utilities;

View File

@ -1,9 +1,10 @@
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Scim.Context;
using Bit.Scim.Groups;
using Bit.Scim.Models;

View File

@ -1,9 +1,10 @@
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Scim.Context;
using Bit.Scim.Groups;
using Bit.Scim.Models;

View File

@ -2,6 +2,8 @@
using Bit.Admin.Models;
using Bit.Admin.Services;
using Bit.Admin.Utilities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;

View File

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Core.Entities.Provider;
using Bit.Core.Enums;

View File

@ -1,4 +1,5 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Core.Entities.Provider;
using Bit.Core.Enums;
using Bit.Core.Models.Data.Organizations.OrganizationUsers;

View File

@ -1,11 +1,12 @@
using Bit.Api.AdminConsole.Models.Request;
using Bit.Api.AdminConsole.Models.Response;
using Bit.Api.Models.Response;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.AdminConsole.Services;
using Bit.Core.Context;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Core.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

View File

@ -2,6 +2,7 @@
using Bit.Api.AdminConsole.Models.Response.Organizations;
using Bit.Api.Models.Request.Organizations;
using Bit.Api.Models.Response;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Enums;
using Bit.Core.Exceptions;

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Bit.Api.Models.Request;
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
namespace Bit.Api.AdminConsole.Models.Request;

View File

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Bit.Core.AdminConsole.Models.Business;
using Bit.Core.Models.Business;
namespace Bit.Api.AdminConsole.Models.Request;
@ -24,7 +25,7 @@ public class ImportOrganizationUsersRequestModel
{
var importedGroup = new ImportedGroup
{
Group = new Core.Entities.Group
Group = new Core.AdminConsole.Entities.Group
{
OrganizationId = organizationId,
Name = Name,

View File

@ -1,5 +1,5 @@
using Bit.Api.Models.Response;
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Models.Api;
using Bit.Core.Models.Data;

View File

@ -2,8 +2,9 @@
using Bit.Api.AdminConsole.Public.Models.Request;
using Bit.Api.AdminConsole.Public.Models.Response;
using Bit.Api.Models.Public.Response;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

View File

@ -2,6 +2,7 @@
using Bit.Api.AdminConsole.Public.Models.Request;
using Bit.Api.AdminConsole.Public.Models.Response;
using Bit.Api.Models.Public.Response;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Models.Business;
using Bit.Core.OrganizationFeatures.OrganizationUsers.Interfaces;

View File

@ -1,5 +1,5 @@
using Bit.Api.Auth.Models.Public.Request;
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
namespace Bit.Api.AdminConsole.Public.Models.Request;

View File

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Models.Business;
using Bit.Core.Models.Business;
using Bit.Core.Utilities;

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Bit.Api.Auth.Models.Public.Response;
using Bit.Api.Models.Public.Response;
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Models.Data;
namespace Bit.Api.AdminConsole.Public.Models.Response;

View File

@ -1,6 +1,7 @@
using Bit.Api.Models.Response;
using Bit.Api.SecretsManager.Models.Request;
using Bit.Api.SecretsManager.Models.Response;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Enums;
using Bit.Core.Exceptions;

View File

@ -1,4 +1,4 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Models.Api;
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
using Bit.Core.SecretsManager.Entities;

View File

@ -1,8 +1,9 @@
using System.ComponentModel.DataAnnotations;
using Bit.Core.Entities;
using Bit.Core.Models;
using Bit.Core.Utilities;
namespace Bit.Core.Entities;
namespace Bit.Core.AdminConsole.Entities;
public class Group : ITableObject<Guid>, IExternal
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Entities;
namespace Bit.Core.AdminConsole.Entities;
public class GroupUser
{

View File

@ -1,6 +1,6 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
namespace Bit.Core.Models.Business;
namespace Bit.Core.AdminConsole.Models.Business;
public class ImportedGroup
{

View File

@ -1,7 +1,7 @@
using System.Data;
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
namespace Bit.Core.Models.Data;
namespace Bit.Core.AdminConsole.Models.Data;
public class GroupWithCollections : Group
{

View File

@ -1,16 +1,18 @@
using Bit.Core.Context;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Data;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Core.Services;
using Bit.Core.Tools.Enums;
using Bit.Core.Tools.Models.Business;
using Bit.Core.Tools.Services;
namespace Bit.Core.OrganizationFeatures.Groups;
namespace Bit.Core.AdminConsole.OrganizationFeatures.Groups;
public class CreateGroupCommand : ICreateGroupCommand
{
@ -46,7 +48,7 @@ public class CreateGroupCommand : ICreateGroupCommand
await GroupRepositoryUpdateUsersAsync(group, users);
}
await _eventService.LogGroupEventAsync(group, Enums.EventType.Group_Created);
await _eventService.LogGroupEventAsync(group, Core.Enums.EventType.Group_Created);
}
public async Task CreateGroupAsync(Group group, Organization organization, EventSystemUser systemUser,
@ -61,7 +63,7 @@ public class CreateGroupCommand : ICreateGroupCommand
await GroupRepositoryUpdateUsersAsync(group, users, systemUser);
}
await _eventService.LogGroupEventAsync(group, Enums.EventType.Group_Created, systemUser);
await _eventService.LogGroupEventAsync(group, Core.Enums.EventType.Group_Created, systemUser);
}
private async Task GroupRepositoryCreateGroupAsync(Group group, Organization organization, IEnumerable<CollectionAccessSelection> collections = null)

View File

@ -1,11 +1,11 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Core.Services;
namespace Bit.Core.OrganizationFeatures.Groups;
namespace Bit.Core.AdminConsole.OrganizationFeatures.Groups;
public class DeleteGroupCommand : IDeleteGroupCommand
{

View File

@ -1,8 +1,9 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
namespace Bit.Core.OrganizationFeatures.Groups.Interfaces;
namespace Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
public interface ICreateGroupCommand
{

View File

@ -1,7 +1,7 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Enums;
namespace Bit.Core.OrganizationFeatures.Groups.Interfaces;
namespace Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
public interface IDeleteGroupCommand
{

View File

@ -1,8 +1,9 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
namespace Bit.Core.OrganizationFeatures.Groups.Interfaces;
namespace Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
public interface IUpdateGroupCommand
{

View File

@ -1,12 +1,14 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Data;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Core.Services;
namespace Bit.Core.OrganizationFeatures.Groups;
namespace Bit.Core.AdminConsole.OrganizationFeatures.Groups;
public class UpdateGroupCommand : IUpdateGroupCommand
{
@ -36,7 +38,7 @@ public class UpdateGroupCommand : IUpdateGroupCommand
await GroupRepositoryUpdateUsersAsync(group, userIds);
}
await _eventService.LogGroupEventAsync(group, Enums.EventType.Group_Updated);
await _eventService.LogGroupEventAsync(group, Core.Enums.EventType.Group_Updated);
}
public async Task UpdateGroupAsync(Group group, Organization organization, EventSystemUser systemUser,
@ -51,7 +53,7 @@ public class UpdateGroupCommand : IUpdateGroupCommand
await GroupRepositoryUpdateUsersAsync(group, userIds, systemUser);
}
await _eventService.LogGroupEventAsync(group, Enums.EventType.Group_Updated, systemUser);
await _eventService.LogGroupEventAsync(group, Core.Enums.EventType.Group_Updated, systemUser);
}
private async Task GroupRepositoryUpdateGroupAsync(Group group, IEnumerable<CollectionAccessSelection> collections = null)

View File

@ -1,7 +1,8 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Models.Data;
using Bit.Core.Repositories;
namespace Bit.Core.Repositories;
namespace Bit.Core.AdminConsole.Repositories;
public interface IGroupRepository : IRepository<Group, Guid>
{

View File

@ -1,7 +1,7 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Enums;
namespace Bit.Core.Services;
namespace Bit.Core.AdminConsole.Services;
public interface IGroupService
{

View File

@ -1,9 +1,12 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Repositories;
using Bit.Core.Services;
namespace Bit.Core.Services;
namespace Bit.Core.AdminConsole.Services.Implementations;
public class GroupService : IGroupService
{

View File

@ -1,8 +1,8 @@
using Bit.Core.AdminConsole.OrganizationAuth;
using Bit.Core.AdminConsole.OrganizationAuth.Interfaces;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Models.Business.Tokenables;
using Bit.Core.OrganizationFeatures.Groups;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.OrganizationFeatures.OrganizationApiKeys;
using Bit.Core.OrganizationFeatures.OrganizationApiKeys.Interfaces;
using Bit.Core.OrganizationFeatures.OrganizationCollections;

View File

@ -1,4 +1,5 @@
using Bit.Core.AdminConsole.Models.OrganizationConnectionConfigs;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Repositories;
using Bit.Core.Context;

View File

@ -1,4 +1,5 @@
#nullable enable
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Core.Utilities;

View File

@ -1,4 +1,5 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Core.Entities.Provider;
using Bit.Core.Enums;
using Bit.Core.SecretsManager.Entities;

View File

@ -1,4 +1,5 @@
using System.Security.Claims;
using Bit.Core.AdminConsole.Models.Business;
using Bit.Core.Auth.Enums;
using Bit.Core.Entities;
using Bit.Core.Enums;

View File

@ -1,4 +1,5 @@
using Bit.Core.Context;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Entities.Provider;
using Bit.Core.Enums;

View File

@ -1,5 +1,8 @@
using System.Security.Claims;
using System.Text.Json;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Models.Business;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Models.Business;
using Bit.Core.Auth.Repositories;

View File

@ -1,4 +1,5 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Core.Entities.Provider;
using Bit.Core.Enums;
using Bit.Core.SecretsManager.Entities;

View File

@ -1,13 +1,16 @@
using System.Data;
using System.Text.Json;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Models.Data;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Entities;
using Bit.Core.Models.Data;
using Bit.Core.Repositories;
using Bit.Core.Settings;
using Bit.Infrastructure.Dapper.Repositories;
using Dapper;
using Microsoft.Data.SqlClient;
namespace Bit.Infrastructure.Dapper.Repositories;
namespace Bit.Infrastructure.Dapper.AdminConsole.Repositories;
public class GroupRepository : Repository<Group, Guid>, IGroupRepository
{

View File

@ -1,8 +1,10 @@
using Bit.Core.Auth.Repositories;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Auth.Repositories;
using Bit.Core.Repositories;
using Bit.Core.SecretsManager.Repositories;
using Bit.Core.Tools.Repositories;
using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.Dapper.AdminConsole.Repositories;
using Bit.Infrastructure.Dapper.Auth.Repositories;
using Bit.Infrastructure.Dapper.Repositories;
using Bit.Infrastructure.Dapper.SecretsManager.Repositories;

View File

@ -1,5 +1,6 @@
using System.Data;
using System.Text.Json;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data;

View File

@ -1,19 +1,21 @@
using AutoMapper;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Models.Data;
using Bit.Core.Repositories;
using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using AdminConsoleEntities = Bit.Core.AdminConsole.Entities;
namespace Bit.Infrastructure.EntityFramework.Repositories;
namespace Bit.Infrastructure.EntityFramework.AdminConsole.Repositories;
public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGroupRepository
public class GroupRepository : Repository<AdminConsoleEntities.Group, Group, Guid>, IGroupRepository
{
public GroupRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Groups)
{ }
public async Task CreateAsync(Core.Entities.Group obj, IEnumerable<CollectionAccessSelection> collections)
public async Task CreateAsync(AdminConsoleEntities.Group obj, IEnumerable<CollectionAccessSelection> collections)
{
var grp = await base.CreateAsync(obj);
using (var scope = ServiceScopeFactory.CreateScope())
@ -51,7 +53,7 @@ public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGr
}
}
public async Task<Tuple<Core.Entities.Group, ICollection<CollectionAccessSelection>>> GetByIdWithCollectionsAsync(Guid id)
public async Task<Tuple<AdminConsoleEntities.Group, ICollection<CollectionAccessSelection>>> GetByIdWithCollectionsAsync(Guid id)
{
var grp = await base.GetByIdAsync(id);
using (var scope = ServiceScopeFactory.CreateScope())
@ -67,12 +69,12 @@ public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGr
ReadOnly = c.ReadOnly,
HidePasswords = c.HidePasswords,
}).ToList();
return new Tuple<Core.Entities.Group, ICollection<CollectionAccessSelection>>(
return new Tuple<AdminConsoleEntities.Group, ICollection<CollectionAccessSelection>>(
grp, collections);
}
}
public async Task<ICollection<Core.Entities.Group>> GetManyByOrganizationIdAsync(Guid organizationId)
public async Task<ICollection<AdminConsoleEntities.Group>> GetManyByOrganizationIdAsync(Guid organizationId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
@ -81,11 +83,11 @@ public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGr
from g in dbContext.Groups
where g.OrganizationId == organizationId
select g).ToListAsync();
return Mapper.Map<List<Core.Entities.Group>>(data);
return Mapper.Map<List<AdminConsoleEntities.Group>>(data);
}
}
public async Task<ICollection<Tuple<Core.Entities.Group, ICollection<CollectionAccessSelection>>>>
public async Task<ICollection<Tuple<AdminConsoleEntities.Group, ICollection<CollectionAccessSelection>>>>
GetManyWithCollectionsByOrganizationIdAsync(Guid organizationId)
{
var groups = await GetManyByOrganizationIdAsync(organizationId);
@ -100,7 +102,7 @@ public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGr
var collections = query.GroupBy(c => c.GroupId).ToList();
return groups.Select(group =>
new Tuple<Core.Entities.Group, ICollection<CollectionAccessSelection>>(
new Tuple<AdminConsoleEntities.Group, ICollection<CollectionAccessSelection>>(
group,
collections
.FirstOrDefault(c => c.Key == group.Id)?
@ -115,7 +117,7 @@ public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGr
}
}
public async Task<ICollection<Core.Entities.Group>> GetManyByManyIds(IEnumerable<Guid> groupIds)
public async Task<ICollection<AdminConsoleEntities.Group>> GetManyByManyIds(IEnumerable<Guid> groupIds)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
@ -124,11 +126,11 @@ public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGr
where groupIds.Contains(g.Id)
select g;
var groups = await query.ToListAsync();
return Mapper.Map<List<Core.Entities.Group>>(groups);
return Mapper.Map<List<AdminConsoleEntities.Group>>(groups);
}
}
public async Task<ICollection<Core.Entities.GroupUser>> GetManyGroupUsersByOrganizationIdAsync(Guid organizationId)
public async Task<ICollection<AdminConsoleEntities.GroupUser>> GetManyGroupUsersByOrganizationIdAsync(Guid organizationId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
@ -140,7 +142,7 @@ public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGr
where g.OrganizationId == organizationId
select gu;
var groupUsers = await query.ToListAsync();
return Mapper.Map<List<Core.Entities.GroupUser>>(groupUsers);
return Mapper.Map<List<AdminConsoleEntities.GroupUser>>(groupUsers);
}
}
@ -172,7 +174,7 @@ public class GroupRepository : Repository<Core.Entities.Group, Group, Guid>, IGr
}
}
public async Task ReplaceAsync(Core.Entities.Group group, IEnumerable<CollectionAccessSelection> requestedCollections)
public async Task ReplaceAsync(AdminConsoleEntities.Group group, IEnumerable<CollectionAccessSelection> requestedCollections)
{
await base.ReplaceAsync(group);
using (var scope = ServiceScopeFactory.CreateScope())

View File

@ -1,9 +1,11 @@
using Bit.Core.Auth.Repositories;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Auth.Repositories;
using Bit.Core.Enums;
using Bit.Core.Repositories;
using Bit.Core.SecretsManager.Repositories;
using Bit.Core.Tools.Repositories;
using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.EntityFramework.AdminConsole.Repositories;
using Bit.Infrastructure.EntityFramework.Auth.Repositories;
using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Infrastructure.EntityFramework.SecretsManager.Repositories;

View File

@ -2,7 +2,7 @@
namespace Bit.Infrastructure.EntityFramework.Models;
public class Group : Core.Entities.Group
public class Group : Core.AdminConsole.Entities.Group
{
public virtual Organization Organization { get; set; }
public virtual ICollection<GroupUser> GroupUsers { get; set; }
@ -12,6 +12,6 @@ public class GroupMapperProfile : Profile
{
public GroupMapperProfile()
{
CreateMap<Core.Entities.Group, Group>().ReverseMap();
CreateMap<Core.AdminConsole.Entities.Group, Group>().ReverseMap();
}
}

View File

@ -2,7 +2,7 @@
namespace Bit.Infrastructure.EntityFramework.Models;
public class GroupUser : Core.Entities.GroupUser
public class GroupUser : Core.AdminConsole.Entities.GroupUser
{
public virtual Group Group { get; set; }
public virtual OrganizationUser OrganizationUser { get; set; }
@ -12,7 +12,7 @@ public class GroupUserMapperProfile : Profile
{
public GroupUserMapperProfile()
{
CreateMap<Core.Entities.GroupUser, GroupUser>().ReverseMap();
CreateMap<Core.AdminConsole.Entities.GroupUser, GroupUser>().ReverseMap();
}
}

View File

@ -3,6 +3,8 @@ using System.Reflection;
using System.Security.Claims;
using System.Security.Cryptography.X509Certificates;
using AspNetCoreRateLimit;
using Bit.Core.AdminConsole.Services;
using Bit.Core.AdminConsole.Services.Implementations;
using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Identity;
using Bit.Core.Auth.IdentityServer;

View File

@ -1,9 +1,11 @@
using Bit.Api.AdminConsole.Controllers;
using Bit.Api.AdminConsole.Models.Request;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Models.Data;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;

View File

@ -1,10 +1,12 @@
using Bit.Api.AdminConsole.Public.Controllers;
using Bit.Api.AdminConsole.Public.Models.Request;
using Bit.Api.AdminConsole.Public.Models.Response;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Models.Data;
using Bit.Core.OrganizationFeatures.Groups.Interfaces;
using Bit.Core.Repositories;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;

View File

@ -2,8 +2,9 @@
using Bit.Api.SecretsManager.Controllers;
using Bit.Api.SecretsManager.Models.Request;
using Bit.Api.Test.SecretsManager.Enums;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Repositories;

View File

@ -1,9 +1,10 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Data;
using Bit.Core.OrganizationFeatures.Groups;
using Bit.Core.Repositories;
using Bit.Core.Services;
using Bit.Core.Test.AutoFixture.OrganizationFixtures;
using Bit.Core.Tools.Enums;
@ -15,7 +16,7 @@ using Bit.Test.Common.Helpers;
using NSubstitute;
using Xunit;
namespace Bit.Core.Test.OrganizationFeatures.Groups;
namespace Bit.Core.Test.AdminConsole.OrganizationFeatures.Groups;
[SutProviderCustomize]
public class CreateGroupCommandTests

View File

@ -1,8 +1,8 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.OrganizationFeatures.Groups;
using Bit.Core.Repositories;
using Bit.Core.Services;
using Bit.Core.Test.AutoFixture.OrganizationFixtures;
using Bit.Test.Common.AutoFixture;
@ -10,7 +10,7 @@ using Bit.Test.Common.AutoFixture.Attributes;
using NSubstitute;
using Xunit;
namespace Bit.Core.Test.OrganizationFeatures.Groups;
namespace Bit.Core.Test.AdminConsole.OrganizationFeatures.Groups;
[SutProviderCustomize]
public class DeleteGroupCommandTests
@ -42,7 +42,7 @@ public class DeleteGroupCommandTests
{
sutProvider.GetDependency<IGroupRepository>()
.GetByIdAsync(groupId)
.Returns(new Core.Entities.Group
.Returns(new Group
{
Id = groupId,
OrganizationId = Guid.NewGuid()

View File

@ -1,9 +1,10 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.OrganizationFeatures.Groups;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Data;
using Bit.Core.OrganizationFeatures.Groups;
using Bit.Core.Repositories;
using Bit.Core.Services;
using Bit.Core.Test.AutoFixture.OrganizationFixtures;
using Bit.Test.Common.AutoFixture;
@ -12,7 +13,7 @@ using Bit.Test.Common.Helpers;
using NSubstitute;
using Xunit;
namespace Bit.Core.Test.OrganizationFeatures.Groups;
namespace Bit.Core.Test.AdminConsole.OrganizationFeatures.Groups;
[SutProviderCustomize]
public class UpdateGroupCommandTests

View File

@ -1,4 +1,7 @@
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.AdminConsole.Services.Implementations;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Repositories;
@ -9,7 +12,7 @@ using Bit.Test.Common.AutoFixture.Attributes;
using NSubstitute;
using Xunit;
namespace Bit.Core.Test.Services;
namespace Bit.Core.Test.AdminConsole.Services;
[SutProviderCustomize]
[OrganizationCustomize(UseGroups = true)]

View File

@ -1,6 +1,7 @@
using System.Text.Json;
using AutoFixture;
using AutoFixture.Kernel;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Auth.Enums;
using Bit.Core.Auth.Models;
using Bit.Core.Entities;

View File

@ -1,4 +1,5 @@
using Bit.Core.Context;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Entities.Provider;
using Bit.Core.Enums;

View File

@ -1,7 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers;
namespace Bit.Infrastructure.EFIntegration.Test.AdminConsole.Repositories.EqualityComparers;
public class GroupCompare : IEqualityComparer<Group>
{

View File

@ -1,7 +1,8 @@
using AutoFixture;
using AutoFixture.Kernel;
using Bit.Core.Entities;
using Bit.Core.AdminConsole.Entities;
using Bit.Infrastructure.EFIntegration.Test.AutoFixture.Relays;
using Bit.Infrastructure.EntityFramework.AdminConsole.Repositories;
using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;

View File

@ -1,7 +1,7 @@
using AutoFixture;
using AutoFixture.Kernel;
using Bit.Core.Entities;
using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Core.AdminConsole.Entities;
using Bit.Infrastructure.EntityFramework.AdminConsole.Repositories;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;