mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
[PM-328] Move files for team-tools (#2857)
* Extract Import-Api endpoints into separate controller Moved ciphers/import and ciphers/import-organization into new ImportController Paths have been kept intact for now (no changes on clients needed) Moved request-models used for import into tools-subfolder * Update CODEOWNERS for team-tools-dev * Move HibpController (reports) to tools * Moving files related to Send * Moving files related to ReferenceEvent * Removed unneeded newline
This commit is contained in:
parent
baec7745f7
commit
4e7b9d2edd
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -8,4 +8,5 @@ bitwarden_license/src/Sso @bitwarden/team-auth-dev
|
||||
src/Identity @bitwarden/team-auth-dev
|
||||
|
||||
**/SecretsManager @bitwarden/team-secrets-manager-dev
|
||||
**/Tools @bitwarden/team-tools-dev
|
||||
**/Vault @bitwarden/team-vault-dev
|
||||
|
@ -1,12 +1,14 @@
|
||||
using Bit.Admin.Models;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Models.OrganizationConnectionConfigs;
|
||||
using Bit.Core.OrganizationFeatures.OrganizationSponsorships.FamiliesForEnterprise.Interfaces;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
@ -5,6 +5,7 @@ using Bit.Core.Providers.Interfaces;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Bit.Admin.Auth.Jobs;
|
||||
using Bit.Admin.Tools.Jobs;
|
||||
using Bit.Core.Jobs;
|
||||
using Bit.Core.Settings;
|
||||
using Quartz;
|
||||
|
@ -1,11 +1,11 @@
|
||||
using Bit.Admin.Auth.Jobs;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Jobs;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Quartz;
|
||||
|
||||
namespace Bit.Admin.Jobs;
|
||||
namespace Bit.Admin.Tools.Jobs;
|
||||
|
||||
public class DeleteSendsJob : BaseJob
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Tools.Models.Request;
|
||||
using Bit.Api.Vault.Models.Request;
|
||||
|
||||
namespace Bit.Api.Auth.Models.Request.Accounts;
|
||||
|
@ -8,7 +8,6 @@ using Bit.Core.Auth.Models.Api.Request.Accounts;
|
||||
using Bit.Core.Auth.Models.Api.Response.Accounts;
|
||||
using Bit.Core.Auth.Services;
|
||||
using Bit.Core.Auth.Utilities;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Enums.Provider;
|
||||
using Bit.Core.Exceptions;
|
||||
@ -18,6 +17,9 @@ using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Bit.Core.Vault.Repositories;
|
||||
|
@ -5,11 +5,13 @@ using Bit.Core.Context;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Identity;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.SecretsManager.Commands.Secrets.Interfaces;
|
||||
using Bit.Core.SecretsManager.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
@ -8,7 +8,7 @@ using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Bit.Api.Controllers;
|
||||
namespace Bit.Api.Tools.Controllers;
|
||||
|
||||
[Route("hibp")]
|
||||
[Authorize("Application")]
|
79
src/Api/Tools/Controllers/ImportCiphersController.cs
Normal file
79
src/Api/Tools/Controllers/ImportCiphersController.cs
Normal file
@ -0,0 +1,79 @@
|
||||
using Bit.Api.Tools.Models.Request.Accounts;
|
||||
using Bit.Api.Tools.Models.Request.Organizations;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Bit.Api.Tools.Controllers;
|
||||
|
||||
[Route("ciphers")]
|
||||
[Authorize("Application")]
|
||||
public class ImportCiphersController : Controller
|
||||
{
|
||||
private readonly ICipherService _cipherService;
|
||||
private readonly IUserService _userService;
|
||||
private readonly ICurrentContext _currentContext;
|
||||
private readonly ILogger<ImportCiphersController> _logger;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public ImportCiphersController(
|
||||
ICollectionCipherRepository collectionCipherRepository,
|
||||
ICipherService cipherService,
|
||||
IUserService userService,
|
||||
IProviderService providerService,
|
||||
ICurrentContext currentContext,
|
||||
ILogger<ImportCiphersController> logger,
|
||||
GlobalSettings globalSettings)
|
||||
{
|
||||
_cipherService = cipherService;
|
||||
_userService = userService;
|
||||
_currentContext = currentContext;
|
||||
_logger = logger;
|
||||
_globalSettings = globalSettings;
|
||||
}
|
||||
|
||||
[HttpPost("import")]
|
||||
public async Task PostImport([FromBody] ImportCiphersRequestModel model)
|
||||
{
|
||||
if (!_globalSettings.SelfHosted &&
|
||||
(model.Ciphers.Count() > 6000 || model.FolderRelationships.Count() > 6000 ||
|
||||
model.Folders.Count() > 1000))
|
||||
{
|
||||
throw new BadRequestException("You cannot import this much data at once.");
|
||||
}
|
||||
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var folders = model.Folders.Select(f => f.ToFolder(userId)).ToList();
|
||||
var ciphers = model.Ciphers.Select(c => c.ToCipherDetails(userId, false)).ToList();
|
||||
await _cipherService.ImportCiphersAsync(folders, ciphers, model.FolderRelationships);
|
||||
}
|
||||
|
||||
[HttpPost("import-organization")]
|
||||
public async Task PostImport([FromQuery] string organizationId,
|
||||
[FromBody] ImportOrganizationCiphersRequestModel model)
|
||||
{
|
||||
if (!_globalSettings.SelfHosted &&
|
||||
(model.Ciphers.Count() > 6000 || model.CollectionRelationships.Count() > 12000 ||
|
||||
model.Collections.Count() > 1000))
|
||||
{
|
||||
throw new BadRequestException("You cannot import this much data at once.");
|
||||
}
|
||||
|
||||
var orgId = new Guid(organizationId);
|
||||
if (!await _currentContext.AccessImportExport(orgId))
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var collections = model.Collections.Select(c => c.ToCollection(orgId)).ToList();
|
||||
var ciphers = model.Ciphers.Select(l => l.ToOrganizationCipherDetails(orgId)).ToList();
|
||||
await _cipherService.ImportCiphersAsync(collections, ciphers, model.CollectionRelationships, userId);
|
||||
}
|
||||
}
|
@ -1,22 +1,24 @@
|
||||
using System.Text.Json;
|
||||
using Azure.Messaging.EventGrid;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.Tools.Models.Request;
|
||||
using Bit.Api.Tools.Models.Response;
|
||||
using Bit.Api.Utilities;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Bit.Api.Controllers;
|
||||
namespace Bit.Api.Tools.Controllers;
|
||||
|
||||
[Route("sends")]
|
||||
[Authorize("Application")]
|
@ -1,6 +1,6 @@
|
||||
using Bit.Api.Vault.Models.Request;
|
||||
|
||||
namespace Bit.Api.Models.Request.Accounts;
|
||||
namespace Bit.Api.Tools.Models.Request.Accounts;
|
||||
|
||||
public class ImportCiphersRequestModel
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
using Bit.Api.Vault.Models.Request;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Vault.Models.Request;
|
||||
|
||||
namespace Bit.Api.Models.Request.Organizations;
|
||||
namespace Bit.Api.Tools.Models.Request.Organizations;
|
||||
|
||||
public class ImportOrganizationCiphersRequestModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Api.Models.Request;
|
||||
namespace Bit.Api.Tools.Models.Request;
|
||||
|
||||
public class SendAccessRequestModel
|
||||
{
|
@ -1,13 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.Models.Request;
|
||||
namespace Bit.Api.Tools.Models.Request;
|
||||
|
||||
public class SendRequestModel
|
||||
{
|
@ -1,12 +1,12 @@
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.Models.Response;
|
||||
namespace Bit.Api.Tools.Models.Response;
|
||||
|
||||
public class SendAccessResponseModel : ResponseModel
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Api.Models.Response;
|
||||
namespace Bit.Api.Tools.Models.Response;
|
||||
|
||||
public class SendFileDownloadDataResponseModel : ResponseModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Api.Models.Response;
|
||||
namespace Bit.Api.Tools.Models.Response;
|
||||
|
||||
public class SendFileUploadDataResponseModel : ResponseModel
|
||||
{
|
@ -1,12 +1,12 @@
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.Models.Response;
|
||||
namespace Bit.Api.Tools.Models.Response;
|
||||
|
||||
public class SendResponseModel : ResponseModel
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.Models;
|
||||
namespace Bit.Api.Tools.Models;
|
||||
|
||||
public class SendFileModel
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.Models;
|
||||
namespace Bit.Api.Tools.Models;
|
||||
|
||||
public class SendTextModel
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Tools.Models.Request;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
|
@ -1,8 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using Azure.Messaging.EventGrid;
|
||||
using Bit.Api.Auth.Models.Request.Accounts;
|
||||
using Bit.Api.Models.Request.Accounts;
|
||||
using Bit.Api.Models.Request.Organizations;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.Utilities;
|
||||
using Bit.Api.Vault.Models.Request;
|
||||
@ -14,6 +12,7 @@ using Bit.Core.Exceptions;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Bit.Core.Vault.Models.Data;
|
||||
@ -235,45 +234,6 @@ public class CiphersController : Controller
|
||||
return new ListResponseModel<CipherMiniDetailsResponseModel>(responses);
|
||||
}
|
||||
|
||||
[HttpPost("import")]
|
||||
public async Task PostImport([FromBody] ImportCiphersRequestModel model)
|
||||
{
|
||||
if (!_globalSettings.SelfHosted &&
|
||||
(model.Ciphers.Count() > 6000 || model.FolderRelationships.Count() > 6000 ||
|
||||
model.Folders.Count() > 1000))
|
||||
{
|
||||
throw new BadRequestException("You cannot import this much data at once.");
|
||||
}
|
||||
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var folders = model.Folders.Select(f => f.ToFolder(userId)).ToList();
|
||||
var ciphers = model.Ciphers.Select(c => c.ToCipherDetails(userId, false)).ToList();
|
||||
await _cipherService.ImportCiphersAsync(folders, ciphers, model.FolderRelationships);
|
||||
}
|
||||
|
||||
[HttpPost("import-organization")]
|
||||
public async Task PostImport([FromQuery] string organizationId,
|
||||
[FromBody] ImportOrganizationCiphersRequestModel model)
|
||||
{
|
||||
if (!_globalSettings.SelfHosted &&
|
||||
(model.Ciphers.Count() > 6000 || model.CollectionRelationships.Count() > 12000 ||
|
||||
model.Collections.Count() > 1000))
|
||||
{
|
||||
throw new BadRequestException("You cannot import this much data at once.");
|
||||
}
|
||||
|
||||
var orgId = new Guid(organizationId);
|
||||
if (!await _currentContext.AccessImportExport(orgId))
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var collections = model.Collections.Select(c => c.ToCollection(orgId)).ToList();
|
||||
var ciphers = model.Ciphers.Select(l => l.ToOrganizationCipherDetails(orgId)).ToList();
|
||||
await _cipherService.ImportCiphersAsync(collections, ciphers, model.CollectionRelationships, userId);
|
||||
}
|
||||
|
||||
[HttpPut("{id}/partial")]
|
||||
[HttpPost("{id}/partial")]
|
||||
public async Task<CipherResponseModel> PutPartial(string id, [FromBody] CipherPartialRequestModel model)
|
||||
|
@ -7,6 +7,7 @@ using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Core.Vault.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -1,10 +1,12 @@
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.Tools.Models.Response;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Api.Response;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Bit.Core.Vault.Models.Data;
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
using Bit.Billing.Constants;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.OrganizationFeatures.OrganizationSponsorships.FamiliesForEnterprise.Interfaces;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
@ -4,6 +4,7 @@ using Bit.Core.Auth.Enums;
|
||||
using Bit.Core.Auth.Models;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Entities;
|
||||
|
@ -3,6 +3,7 @@ using System.Text.Json;
|
||||
using Bit.Core.Auth.Enums;
|
||||
using Bit.Core.Auth.Models;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Business;
|
||||
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;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Auth.Entities;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
|
@ -4,6 +4,7 @@ using Bit.Core.Auth.Models;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Fido2NetLib;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
@ -2,10 +2,10 @@
|
||||
using Azure.Storage.Queues;
|
||||
using Bit.Core.Auth.Entities;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
@ -1,10 +1,11 @@
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Bit.Core.Auth.Entities;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
@ -2,12 +2,12 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Bit.Core.Auth.Entities;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Azure.NotificationHubs;
|
||||
|
@ -1,9 +1,9 @@
|
||||
using Bit.Core.Auth.Entities;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -14,6 +14,9 @@ using Bit.Core.Models.Data.Organizations.Policies;
|
||||
using Bit.Core.Models.OrganizationConnectionConfigs;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -1,12 +1,12 @@
|
||||
using Bit.Core.Auth.Entities;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.IdentityServer;
|
||||
using Bit.Core.Models;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -9,6 +9,10 @@ using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Bit.Core.Vault.Repositories;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Auth.Entities;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace Bit.Core.Entities;
|
||||
namespace Bit.Core.Tools.Entities;
|
||||
|
||||
public interface IReferenceable
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Entities;
|
||||
namespace Bit.Core.Tools.Entities;
|
||||
|
||||
public class Send : ITableObject<Guid>
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Bit.Core.Enums;
|
||||
namespace Bit.Core.Tools.Enums;
|
||||
|
||||
public enum ReferenceEventSource
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Bit.Core.Enums;
|
||||
namespace Bit.Core.Tools.Enums;
|
||||
|
||||
public enum ReferenceEventType
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Bit.Core.Enums;
|
||||
namespace Bit.Core.Tools.Enums;
|
||||
|
||||
public enum SendType : byte
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
|
||||
namespace Bit.Core.Models.Business;
|
||||
namespace Bit.Core.Tools.Models.Business;
|
||||
|
||||
public class ReferenceEvent
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Bit.Core.Models.Data;
|
||||
namespace Bit.Core.Tools.Models.Data;
|
||||
|
||||
public abstract class SendData
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Bit.Core.Models.Data;
|
||||
namespace Bit.Core.Tools.Models.Data;
|
||||
|
||||
public class SendFileData : SendData
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Bit.Core.Models.Data;
|
||||
namespace Bit.Core.Tools.Models.Data;
|
||||
|
||||
public class SendTextData : SendData
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Tools.Entities;
|
||||
|
||||
namespace Bit.Core.Repositories;
|
||||
namespace Bit.Core.Tools.Repositories;
|
||||
|
||||
public interface ISendRepository : IRepository<Send, Guid>
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Tools.Services;
|
||||
|
||||
public interface IReferenceEventService
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Tools.Services;
|
||||
|
||||
public interface ISendService
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Tools.Entities;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Tools.Services;
|
||||
|
||||
public interface ISendFileStorageService
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Azure.Storage.Queues;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Tools.Services;
|
||||
|
||||
public class AzureQueueReferenceEventService : IReferenceEventService
|
||||
{
|
@ -1,12 +1,12 @@
|
||||
using Azure.Storage.Blobs;
|
||||
using Azure.Storage.Blobs.Models;
|
||||
using Azure.Storage.Sas;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Tools.Services;
|
||||
|
||||
public class AzureSendFileStorageService : ISendFileStorageService
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Tools.Services;
|
||||
|
||||
public class LocalSendStorageService : ISendFileStorageService
|
||||
{
|
@ -3,15 +3,19 @@ using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Data.Organizations.Policies;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Tools.Services;
|
||||
|
||||
public class SendService : ISendService
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Tools.Services;
|
||||
|
||||
public class NoopReferenceEventService : IReferenceEventService
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Tools.Entities;
|
||||
|
||||
namespace Bit.Core.Services;
|
||||
namespace Bit.Core.Tools.Services;
|
||||
|
||||
public class NoopSendFileStorageService : ISendFileStorageService
|
||||
{
|
@ -1,5 +1,6 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Bit.Core.Vault.Models.Data;
|
||||
|
||||
|
@ -3,10 +3,12 @@ using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Bit.Core.Vault.Models.Data;
|
||||
|
@ -1,10 +1,12 @@
|
||||
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.Auth.Repositories;
|
||||
using Bit.Infrastructure.Dapper.Repositories;
|
||||
using Bit.Infrastructure.Dapper.SecretsManager.Repositories;
|
||||
using Bit.Infrastructure.Dapper.Tools.Repositories;
|
||||
using Bit.Infrastructure.Dapper.Vault.Repositories;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
using System.Data;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Infrastructure.Dapper.Repositories;
|
||||
using Dapper;
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
||||
namespace Bit.Infrastructure.Dapper.Repositories;
|
||||
namespace Bit.Infrastructure.Dapper.Tools.Repositories;
|
||||
|
||||
public class SendRepository : Repository<Send, Guid>, ISendRepository
|
||||
{
|
@ -2,6 +2,7 @@
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Bit.Core.Vault.Models.Data;
|
||||
using Bit.Core.Vault.Repositories;
|
||||
|
@ -2,10 +2,12 @@
|
||||
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.Auth.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.SecretsManager.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.Tools.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.Vault.Repositories;
|
||||
using LinqToDB.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Models;
|
||||
|
||||
public class Send : Core.Entities.Send
|
||||
public class Send : Core.Tools.Entities.Send
|
||||
{
|
||||
public virtual Organization Organization { get; set; }
|
||||
public virtual User User { get; set; }
|
||||
@ -12,6 +12,6 @@ public class SendMapperProfile : Profile
|
||||
{
|
||||
public SendMapperProfile()
|
||||
{
|
||||
CreateMap<Core.Entities.Send, Send>().ReverseMap();
|
||||
CreateMap<Core.Tools.Entities.Send, Send>().ReverseMap();
|
||||
}
|
||||
}
|
@ -1,18 +1,19 @@
|
||||
using AutoMapper;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Repositories;
|
||||
namespace Bit.Infrastructure.EntityFramework.Tools.Repositories;
|
||||
|
||||
public class SendRepository : Repository<Core.Entities.Send, Send, Guid>, ISendRepository
|
||||
public class SendRepository : Repository<Core.Tools.Entities.Send, Send, Guid>, ISendRepository
|
||||
{
|
||||
public SendRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
|
||||
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Sends)
|
||||
{ }
|
||||
|
||||
public override async Task<Core.Entities.Send> CreateAsync(Core.Entities.Send send)
|
||||
public override async Task<Core.Tools.Entities.Send> CreateAsync(Core.Tools.Entities.Send send)
|
||||
{
|
||||
send = await base.CreateAsync(send);
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
@ -29,23 +30,23 @@ public class SendRepository : Repository<Core.Entities.Send, Send, Guid>, ISendR
|
||||
return send;
|
||||
}
|
||||
|
||||
public async Task<ICollection<Core.Entities.Send>> GetManyByDeletionDateAsync(DateTime deletionDateBefore)
|
||||
public async Task<ICollection<Core.Tools.Entities.Send>> GetManyByDeletionDateAsync(DateTime deletionDateBefore)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
var results = await dbContext.Sends.Where(s => s.DeletionDate < deletionDateBefore).ToListAsync();
|
||||
return Mapper.Map<List<Core.Entities.Send>>(results);
|
||||
return Mapper.Map<List<Core.Tools.Entities.Send>>(results);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Core.Entities.Send>> GetManyByUserIdAsync(Guid userId)
|
||||
public async Task<ICollection<Core.Tools.Entities.Send>> GetManyByUserIdAsync(Guid userId)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
var results = await dbContext.Sends.Where(s => s.UserId == userId).ToListAsync();
|
||||
return Mapper.Map<List<Core.Entities.Send>>(results);
|
||||
return Mapper.Map<List<Core.Tools.Entities.Send>>(results);
|
||||
}
|
||||
}
|
||||
}
|
@ -771,7 +771,7 @@ public class CipherRepository : Repository<Core.Vault.Entities.Cipher, Cipher, G
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateUserKeysAndCiphersAsync(User user, IEnumerable<Core.Vault.Entities.Cipher> ciphers, IEnumerable<Core.Vault.Entities.Folder> folders, IEnumerable<Core.Entities.Send> sends)
|
||||
public async Task UpdateUserKeysAndCiphersAsync(User user, IEnumerable<Core.Vault.Entities.Cipher> ciphers, IEnumerable<Core.Vault.Entities.Folder> folders, IEnumerable<Core.Tools.Entities.Send> sends)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
|
@ -19,6 +19,7 @@ using Bit.Core.Resources;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tokens;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Services;
|
||||
using Bit.Infrastructure.Dapper;
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<Project DefaultTargets="Build"
|
||||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@ -79,6 +80,11 @@
|
||||
<Folder Include="SecretsManager\dbo\Stored Procedures\ApiKey\" />
|
||||
<Folder Include="SecretsManager\dbo\Tables\" />
|
||||
<Folder Include="SecretsManager\dbo\Views\" />
|
||||
<Folder Include="Tools\" />
|
||||
<Folder Include="Tools\dbo" />
|
||||
<Folder Include="Tools\dbo\Tables" />
|
||||
<Folder Include="Tools\dbo\Stored Procedures\" />
|
||||
<Folder Include="Vault\" />
|
||||
<Folder Include="Vault\dbo\" />
|
||||
<Folder Include="Vault\dbo\Functions\" />
|
||||
<Folder Include="Vault\dbo\Stored Procedures\" />
|
||||
@ -86,6 +92,7 @@
|
||||
<Folder Include="Vault\dbo\Stored Procedures\Folder\" />
|
||||
<Folder Include="Vault\dbo\Tables\" />
|
||||
<Folder Include="Vault\dbo\Views\" />
|
||||
<Folder Include="Tools\dbo\Views\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Auth\dbo\Stored Procedures\AuthRequest_Create.sql" />
|
||||
@ -322,12 +329,6 @@
|
||||
<Build Include="dbo\Stored Procedures\Provider_ReadById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Provider_Search.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Provider_Update.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Send_Create.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Send_DeleteById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Send_ReadByDeletionDateBefore.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Send_ReadById.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Send_ReadByUserId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Send_Update.sql" />
|
||||
<Build Include="dbo\Stored Procedures\TaxRate_Archive.sql" />
|
||||
<Build Include="dbo\Stored Procedures\TaxRate_Create.sql" />
|
||||
<Build Include="dbo\Stored Procedures\TaxRate_ReadAllActive.sql" />
|
||||
@ -387,7 +388,6 @@
|
||||
<Build Include="dbo\Tables\Provider.sql" />
|
||||
<Build Include="dbo\Tables\ProviderOrganization.sql" />
|
||||
<Build Include="dbo\Tables\ProviderUser.sql" />
|
||||
<Build Include="dbo\Tables\Send.sql" />
|
||||
<Build Include="dbo\Tables\TaxRate.sql" />
|
||||
<Build Include="dbo\Tables\Transaction.sql" />
|
||||
<Build Include="dbo\Tables\User.sql" />
|
||||
@ -418,7 +418,6 @@
|
||||
<Build Include="dbo\Views\ProviderUserUserDetailsView.sql" />
|
||||
<Build Include="dbo\Views\ProviderUserView.sql" />
|
||||
<Build Include="dbo\Views\ProviderView.sql" />
|
||||
<Build Include="dbo\Views\SendView.sql" />
|
||||
<Build Include="dbo\Views\TransactionView.sql" />
|
||||
<Build Include="dbo\Views\UserView.sql" />
|
||||
<Build Include="SecretsManager\dbo\Stored Procedures\ApiKey\ApiKeyDetails_ReadById.sql" />
|
||||
@ -433,6 +432,14 @@
|
||||
<Build Include="SecretsManager\dbo\Tables\ServiceAccount.sql" />
|
||||
<Build Include="SecretsManager\dbo\Views\ApiKeyDetailsView.sql" />
|
||||
<Build Include="SecretsManager\dbo\Views\ApiKeyView.sql" />
|
||||
<Build Include="Tools\dbo\Stored Procedures\Send_Create.sql" />
|
||||
<Build Include="Tools\dbo\Stored Procedures\Send_DeleteById.sql" />
|
||||
<Build Include="Tools\dbo\Stored Procedures\Send_ReadByDeletionDateBefore.sql" />
|
||||
<Build Include="Tools\dbo\Stored Procedures\Send_ReadById.sql" />
|
||||
<Build Include="Tools\dbo\Stored Procedures\Send_ReadByUserId.sql" />
|
||||
<Build Include="Tools\dbo\Stored Procedures\Send_Update.sql" />
|
||||
<Build Include="Tools\dbo\Tables\Send.sql" />
|
||||
<Build Include="Tools\dbo\Views\SendView.sql" />
|
||||
<Build Include="Vault\dbo\Functions\CipherDetails.sql" />
|
||||
<Build Include="Vault\dbo\Functions\UserCipherDetails.sql" />
|
||||
<Build Include="Vault\dbo\Stored Procedures\Cipher\CipherDetails_Create.sql" />
|
||||
|
@ -10,6 +10,8 @@ using Bit.Core.Models.Data;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Vault.Repositories;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using NSubstitute;
|
||||
|
@ -1,22 +1,24 @@
|
||||
using System.Text.Json;
|
||||
using AutoFixture.Xunit2;
|
||||
using Bit.Api.Controllers;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Response;
|
||||
using Bit.Api.Tools.Controllers;
|
||||
using Bit.Api.Tools.Models.Request;
|
||||
using Bit.Api.Tools.Models.Response;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Api.Test.Controllers;
|
||||
namespace Bit.Api.Test.Tools.Controllers;
|
||||
|
||||
public class SendsControllerTests : IDisposable
|
||||
{
|
@ -1,12 +1,11 @@
|
||||
using System.Text.Json;
|
||||
using Bit.Api.Models;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Api.Tools.Models;
|
||||
using Bit.Api.Tools.Models.Request;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Test.Common.Helpers;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Api.Test.Models.Request;
|
||||
|
||||
public class SendRequestModelTests
|
@ -11,6 +11,8 @@ using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Entities;
|
||||
using Bit.Core.Vault.Models.Data;
|
||||
|
@ -1,12 +1,14 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Business;
|
||||
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;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using Bit.Test.Common.Helpers;
|
||||
|
@ -16,6 +16,9 @@ using Bit.Core.Settings;
|
||||
using Bit.Core.Test.AutoFixture.OrganizationFixtures;
|
||||
using Bit.Core.Test.AutoFixture.OrganizationUserFixtures;
|
||||
using Bit.Core.Test.AutoFixture.PolicyFixtures;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Business;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using NSubstitute;
|
||||
|
@ -1,8 +1,8 @@
|
||||
using AutoFixture;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
|
||||
namespace Bit.Core.Test.AutoFixture.SendFixtures;
|
||||
namespace Bit.Core.Test.Tools.AutoFixture.SendFixtures;
|
||||
|
||||
internal class UserSend : ICustomization
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Test.Common.Helpers;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Core.Test.Models.Data;
|
||||
namespace Bit.Core.Test.Tools.Models.Data;
|
||||
|
||||
public class SendFileDataTests
|
||||
{
|
@ -3,20 +3,24 @@ using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Data.Organizations.Policies;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Test.AutoFixture.CurrentContextFixtures;
|
||||
using Bit.Core.Test.AutoFixture.SendFixtures;
|
||||
using Bit.Core.Test.Entities;
|
||||
using Bit.Core.Test.Tools.AutoFixture.SendFixtures;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Core.Tools.Enums;
|
||||
using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Core.Tools.Repositories;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Core.Test.Services;
|
||||
namespace Bit.Core.Test.Tools.Services;
|
||||
|
||||
[SutProviderCustomize]
|
||||
[CurrentContextCustomize]
|
@ -1,13 +1,15 @@
|
||||
using AutoFixture;
|
||||
using AutoFixture.Kernel;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Test.AutoFixture.UserFixtures;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Infrastructure.EFIntegration.Test.AutoFixture;
|
||||
using Bit.Infrastructure.EFIntegration.Test.AutoFixture.Relays;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using Bit.Infrastructure.EntityFramework.Tools.Repositories;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
|
||||
namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture;
|
||||
namespace Bit.Infrastructure.EFIntegration.Test.Tools.AutoFixture;
|
||||
|
||||
internal class SendBuilder : ISpecimenBuilder
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Tools.Entities;
|
||||
|
||||
namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers;
|
||||
namespace Bit.Infrastructure.EFIntegration.Test.Tools.Repositories.EqualityComparers;
|
||||
|
||||
public class SendCompare : IEqualityComparer<Send>
|
||||
{
|
@ -1,12 +1,15 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Test.AutoFixture.Attributes;
|
||||
using Bit.Infrastructure.EFIntegration.Test.AutoFixture;
|
||||
using Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers;
|
||||
using Bit.Core.Tools.Entities;
|
||||
using Bit.Infrastructure.EFIntegration.Test.Tools.AutoFixture;
|
||||
using Bit.Infrastructure.EFIntegration.Test.Tools.Repositories.EqualityComparers;
|
||||
using Xunit;
|
||||
using EfRepo = Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using EfSendRepo = Bit.Infrastructure.EntityFramework.Tools.Repositories;
|
||||
using SqlRepo = Bit.Infrastructure.Dapper.Repositories;
|
||||
using SqlSendRepo = Bit.Infrastructure.Dapper.Tools.Repositories;
|
||||
|
||||
namespace Bit.Infrastructure.EFIntegration.Test.Repositories;
|
||||
namespace Bit.Infrastructure.EFIntegration.Test.Tools.Repositories;
|
||||
|
||||
public class SendRepositoryTests
|
||||
{
|
||||
@ -16,10 +19,10 @@ public class SendRepositoryTests
|
||||
User user,
|
||||
Organization org,
|
||||
SendCompare equalityComparer,
|
||||
List<EfRepo.SendRepository> suts,
|
||||
List<EfSendRepo.SendRepository> suts,
|
||||
List<EfRepo.UserRepository> efUserRepos,
|
||||
List<EfRepo.OrganizationRepository> efOrgRepos,
|
||||
SqlRepo.SendRepository sqlSendRepo,
|
||||
SqlSendRepo.SendRepository sqlSendRepo,
|
||||
SqlRepo.UserRepository sqlUserRepo,
|
||||
SqlRepo.OrganizationRepository sqlOrgRepo
|
||||
)
|
@ -2,6 +2,7 @@
|
||||
using Bit.Core.Auth.Services;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Tools.Services;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
|
Loading…
Reference in New Issue
Block a user