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

[SG-998] Move files to Vault folders (#2724)

* Move Api files

* Move Core files

* Move Infrastructure files

* Move Sql Files

* Move Api Sync files to Vault

* Move test vault files

* Update Sql.sqlproj paths

* Update Codeowners

* Fix vault file paths in sqlproj

* Update CipherDetails.sql path in sqlproj

* Update Core models and entities namespaces

* Update namespaces Core Services and Repositories

* Missed service namespaces

* Update Api namespaces

* Update Infrastructure namespaces

* Move infrastructure queries that were missed

* Tests namespace updates

* Admin and Events namespace updates

* Remove unused usings

* Remove extra CiphersController usings

* Rename folder

* Fix CipherDetails namespace

* Sqlproj fixes

* Move stored procs into folders by table

* using order fix
This commit is contained in:
Robyn MacCallum
2023-03-02 13:23:38 -05:00
committed by GitHub
parent 05f5d79938
commit 3289a8c35e
162 changed files with 375 additions and 267 deletions

View File

@ -1,6 +1,7 @@
using Bit.Core.Utilities;
using Bit.Core.Entities;
using Bit.Core.Utilities;
namespace Bit.Core.Entities;
namespace Bit.Core.Vault.Entities;
public class Folder : ITableObject<Guid>
{

View File

@ -1,5 +1,5 @@
using Bit.Core.Entities;
using Core.Models.Data;
using Bit.Core.Vault.Models.Data;
namespace Bit.Core.Models.Data;

View File

@ -1,5 +1,5 @@
using Bit.Core.Entities;
using Bit.Core.Models.Data;
using Bit.Core.Models.Data;
using Bit.Core.Vault.Entities;
namespace Bit.Core.Repositories;

View File

@ -1,7 +1,7 @@
using Bit.Core.Entities;
using Bit.Core.Models.Data;
using Bit.Core.Models.Data;
using Bit.Core.Settings;
using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
using Microsoft.Azure.Cosmos.Table;
namespace Bit.Core.Repositories.TableStorage;

View File

@ -1,6 +1,7 @@
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Enums;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Core.Services;

View File

@ -1,6 +1,7 @@
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Vault.Models.Data;
namespace Bit.Core.Services;

View File

@ -2,6 +2,7 @@
using Bit.Core.Entities.Provider;
using Bit.Core.Enums;
using Bit.Core.SecretsManager.Entities;
using Bit.Core.Vault.Entities;
namespace Bit.Core.Services;

View File

@ -1,5 +1,6 @@
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Vault.Entities;
namespace Bit.Core.Services;

View File

@ -3,6 +3,7 @@ using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models;
using Bit.Core.Models.Business;
using Bit.Core.Vault.Entities;
using Fido2NetLib;
using Microsoft.AspNetCore.Identity;

View File

@ -6,6 +6,7 @@ using Bit.Core.Enums;
using Bit.Core.Models;
using Bit.Core.Settings;
using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
using Microsoft.AspNetCore.Http;
namespace Bit.Core.Services;

View File

@ -7,6 +7,9 @@ using Bit.Core.Models.Data;
using Bit.Core.Repositories;
using Bit.Core.Settings;
using Bit.Core.Tokens;
using Bit.Core.Vault.Models.Data;
using Bit.Core.Vault.Repositories;
using Bit.Core.Vault.Services;
using Microsoft.AspNetCore.Identity;
namespace Bit.Core.Services;

View File

@ -7,6 +7,7 @@ using Bit.Core.Models.Data.Organizations;
using Bit.Core.Repositories;
using Bit.Core.SecretsManager.Entities;
using Bit.Core.Settings;
using Bit.Core.Vault.Entities;
namespace Bit.Core.Services;

View File

@ -3,6 +3,7 @@ using Bit.Core.Enums;
using Bit.Core.Repositories;
using Bit.Core.Settings;
using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;

View File

@ -7,6 +7,7 @@ using Bit.Core.Models;
using Bit.Core.Models.Data;
using Bit.Core.Repositories;
using Bit.Core.Settings;
using Bit.Core.Vault.Entities;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.NotificationHubs;
using Microsoft.Extensions.Logging;

View File

@ -3,6 +3,7 @@ using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models;
using Bit.Core.Settings;
using Bit.Core.Vault.Entities;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;

View File

@ -6,6 +6,7 @@ using Bit.Core.Models;
using Bit.Core.Models.Api;
using Bit.Core.Repositories;
using Bit.Core.Settings;
using Bit.Core.Vault.Entities;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;

View File

@ -9,6 +9,8 @@ using Bit.Core.Models.Business;
using Bit.Core.Repositories;
using Bit.Core.Settings;
using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Repositories;
using Fido2NetLib;
using Fido2NetLib.Objects;
using Microsoft.AspNetCore.DataProtection;

View File

@ -2,6 +2,7 @@
using Bit.Core.Entities.Provider;
using Bit.Core.Enums;
using Bit.Core.SecretsManager.Entities;
using Bit.Core.Vault.Entities;
namespace Bit.Core.Services;

View File

@ -1,5 +1,6 @@
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Vault.Entities;
namespace Bit.Core.Services;

View File

@ -1,8 +1,9 @@
using System.Text.Json;
using Bit.Core.Models.Data;
using Bit.Core.Entities;
using Bit.Core.Utilities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Core.Entities;
namespace Bit.Core.Vault.Entities;
public class Cipher : ITableObject<Guid>, ICloneable
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Enums;
namespace Bit.Core.Vault.Enums;
public enum CipherRepromptType : byte
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Enums;
namespace Bit.Core.Vault.Enums;
public enum CipherStateAction
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Enums;
namespace Bit.Core.Vault.Enums;
public enum CipherType : byte
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Enums;
namespace Bit.Core.Vault.Enums;
public enum FieldType : byte
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Enums;
namespace Bit.Core.Vault.Enums;
public enum SecureNoteType : byte
{

View File

@ -1,6 +1,6 @@
using Bit.Core.Entities;
using Bit.Core.Vault.Entities;
namespace Bit.Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class AttachmentResponseData
{

View File

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Bit.Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class CipherAttachment
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class CipherCardData : CipherData
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public abstract class CipherData
{

View File

@ -1,4 +1,4 @@
namespace Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class CipherDetails : CipherOrganizationDetails
{

View File

@ -1,6 +1,6 @@
using Bit.Core.Enums;
using Bit.Core.Vault.Enums;
namespace Bit.Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class CipherFieldData
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class CipherIdentityData : CipherData
{

View File

@ -1,6 +1,6 @@
using Bit.Core.Enums;
namespace Bit.Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class CipherLoginData : CipherData
{

View File

@ -1,6 +1,6 @@
using Bit.Core.Entities;
using Bit.Core.Vault.Entities;
namespace Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class CipherOrganizationDetails : Cipher
{

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class CipherPasswordHistoryData
{

View File

@ -1,6 +1,6 @@
using Bit.Core.Enums;
using Bit.Core.Vault.Enums;
namespace Bit.Core.Models.Data;
namespace Bit.Core.Vault.Models.Data;
public class CipherSecureNoteData : CipherData
{

View File

@ -1,8 +1,9 @@
using Bit.Core.Entities;
using Bit.Core.Models.Data;
using Core.Models.Data;
using Bit.Core.Repositories;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Core.Repositories;
namespace Bit.Core.Vault.Repositories;
public interface ICipherRepository : IRepository<Cipher, Guid>
{

View File

@ -1,6 +1,7 @@
using Bit.Core.Entities;
using Bit.Core.Repositories;
using Bit.Core.Vault.Entities;
namespace Bit.Core.Repositories;
namespace Bit.Core.Vault.Repositories;
public interface IFolderRepository : IRepository<Folder, Guid>
{

View File

@ -1,8 +1,8 @@
using Bit.Core.Entities;
using Bit.Core.Models.Data;
using Core.Models.Data;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Core.Services;
namespace Bit.Core.Vault.Services;
public interface ICipherService
{

View File

@ -1,13 +1,14 @@
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
using Azure.Storage.Sas;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Services;
using Bit.Core.Settings;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
using Microsoft.Extensions.Logging;
namespace Bit.Core.Services;
namespace Bit.Core.Vault.Services;
public class AzureAttachmentStorageService : IAttachmentStorageService
{

View File

@ -4,13 +4,15 @@ 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.Services;
using Bit.Core.Settings;
using Bit.Core.Utilities;
using Core.Models.Data;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
using Bit.Core.Vault.Repositories;
namespace Bit.Core.Services;
namespace Bit.Core.Vault.Services;
public class CipherService : ICipherService
{
@ -90,7 +92,7 @@ public class CipherService : ICipherService
{
await _cipherRepository.CreateAsync(cipher);
}
await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Created);
await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Created);
// push
await _pushService.PushSyncCipherCreateAsync(cipher, null);
@ -100,7 +102,7 @@ public class CipherService : ICipherService
ValidateCipherLastKnownRevisionDateAsync(cipher, lastKnownRevisionDate);
cipher.RevisionDate = DateTime.UtcNow;
await _cipherRepository.ReplaceAsync(cipher);
await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Updated);
await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Updated);
// push
await _pushService.PushSyncCipherUpdateAsync(cipher, collectionIds);
@ -138,7 +140,7 @@ public class CipherService : ICipherService
}
await _cipherRepository.CreateAsync(cipher);
}
await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Created);
await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Created);
if (cipher.OrganizationId.HasValue)
{
@ -154,7 +156,7 @@ public class CipherService : ICipherService
ValidateCipherLastKnownRevisionDateAsync(cipher, lastKnownRevisionDate);
cipher.RevisionDate = DateTime.UtcNow;
await _cipherRepository.ReplaceAsync(cipher);
await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Updated);
await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Updated);
// push
await _pushService.PushSyncCipherUpdateAsync(cipher, collectionIds);
@ -236,7 +238,7 @@ public class CipherService : ICipherService
};
await _cipherRepository.UpdateAttachmentAsync(attachment);
await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_AttachmentCreated);
await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_AttachmentCreated);
cipher.AddAttachment(attachmentId, data);
if (!await ValidateCipherAttachmentFile(cipher, data))
@ -436,7 +438,7 @@ public class CipherService : ICipherService
throw new NotFoundException();
}
await _cipherRepository.DeleteByOrganizationIdAsync(organizationId);
await _eventService.LogOrganizationEventAsync(org, Enums.EventType.Organization_PurgedVault);
await _eventService.LogOrganizationEventAsync(org, Bit.Core.Enums.EventType.Organization_PurgedVault);
}
public async Task MoveManyAsync(IEnumerable<Guid> cipherIds, Guid? destinationFolderId, Guid movingUserId)
@ -505,7 +507,7 @@ public class CipherService : ICipherService
}
updatedCipher = true;
await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Shared);
await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Shared);
if (hasOldAttachments)
{
@ -614,7 +616,7 @@ public class CipherService : ICipherService
await _collectionCipherRepository.UpdateCollectionsAsync(cipher.Id, savingUserId, collectionIds);
}
await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_UpdatedCollections);
await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_UpdatedCollections);
// push
await _pushService.PushSyncCipherUpdateAsync(cipher, collectionIds);
@ -913,7 +915,7 @@ public class CipherService : ICipherService
await _cipherRepository.DeleteAttachmentAsync(cipher.Id, attachmentData.AttachmentId);
cipher.DeleteAttachment(attachmentData.AttachmentId);
await _attachmentStorageService.DeleteAttachmentAsync(cipher.Id, attachmentData);
await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_AttachmentDeleted);
await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_AttachmentDeleted);
// push
await _pushService.PushSyncCipherUpdateAsync(cipher, null);

View File

@ -1,9 +1,10 @@
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Enums;
using Bit.Core.Services;
using Bit.Core.Settings;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Core.Services;
namespace Bit.Core.Vault.Services;
public class LocalAttachmentStorageService : IAttachmentStorageService
{

View File

@ -1,8 +1,9 @@
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Enums;
using Bit.Core.Services;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Core.Services;
namespace Bit.Core.Vault.Services;
public class NoopAttachmentStorageService : IAttachmentStorageService
{