1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01: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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
162 changed files with 375 additions and 267 deletions

1
.github/CODEOWNERS vendored
View File

@ -3,3 +3,4 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
**/SecretsManager @bitwarden/pod-sm-dev **/SecretsManager @bitwarden/pod-sm-dev
**/Vault @bitwarden/team-vault-dev

View File

@ -8,6 +8,7 @@ using Bit.Core.Repositories;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Repositories;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;

View File

@ -4,6 +4,7 @@ using Bit.Core.Repositories;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Repositories;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;

View File

@ -1,6 +1,6 @@
using Bit.Core; using Bit.Core;
using Bit.Core.Jobs; using Bit.Core.Jobs;
using Bit.Core.Repositories; using Bit.Core.Vault.Repositories;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Quartz; using Quartz;

View File

@ -5,6 +5,7 @@ using Bit.Core.Models.Business;
using Bit.Core.Models.Data.Organizations.OrganizationUsers; using Bit.Core.Models.Data.Organizations.OrganizationUsers;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
namespace Bit.Admin.Models; namespace Bit.Admin.Models;

View File

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

View File

@ -3,6 +3,7 @@ using Bit.Core.Entities;
using Bit.Core.Models.Business; using Bit.Core.Models.Business;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
namespace Bit.Admin.Models; namespace Bit.Admin.Models;

View File

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

View File

@ -15,6 +15,8 @@ using Bit.Core.Repositories;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Repositories;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;

View File

@ -1,6 +1,7 @@
using Bit.Api.Models.Request; using Bit.Api.Models.Request;
using Bit.Api.Models.Request.Organizations; using Bit.Api.Models.Request.Organizations;
using Bit.Api.Models.Response; using Bit.Api.Models.Response;
using Bit.Api.Vault.Models.Response;
using Bit.Core.Entities; using Bit.Core.Entities;
using Bit.Core.Exceptions; using Bit.Core.Exceptions;
using Bit.Core.Repositories; using Bit.Core.Repositories;

View File

@ -4,6 +4,7 @@ using Bit.Core.Exceptions;
using Bit.Core.Models.Data; using Bit.Core.Models.Data;
using Bit.Core.Repositories; using Bit.Core.Repositories;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Vault.Repositories;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;

View File

@ -1,9 +1,11 @@
using Bit.Api.Models.Response; using Bit.Api.Models.Response;
using Bit.Api.Vault.Models.Response;
using Bit.Core.Context; using Bit.Core.Context;
using Bit.Core.Entities; using Bit.Core.Entities;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Settings; using Bit.Core.Settings;
using Core.Models.Data; using Bit.Core.Vault.Models.Data;
using Bit.Core.Vault.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;

View File

@ -1,4 +1,6 @@
namespace Bit.Api.Models.Request.Accounts; using Bit.Api.Vault.Models.Request;
namespace Bit.Api.Models.Request.Accounts;
public class ImportCiphersRequestModel public class ImportCiphersRequestModel
{ {

View File

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Bit.Api.Vault.Models.Request;
namespace Bit.Api.Models.Request.Accounts; namespace Bit.Api.Models.Request.Accounts;

View File

@ -1,4 +1,6 @@
namespace Bit.Api.Models.Request.Organizations; using Bit.Api.Vault.Models.Request;
namespace Bit.Api.Models.Request.Organizations;
public class ImportOrganizationCiphersRequestModel public class ImportOrganizationCiphersRequestModel
{ {

View File

@ -1,9 +1,10 @@
using Bit.Core.Entities; using Bit.Api.Vault.Models.Response;
using Bit.Core.Entities;
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Models.Api; using Bit.Core.Models.Api;
using Bit.Core.Models.Data; using Bit.Core.Models.Data;
using Bit.Core.Settings; using Bit.Core.Settings;
using Core.Models.Data; using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models.Response; namespace Bit.Api.Models.Response;

View File

@ -1,4 +1,5 @@
using Bit.Core.Models.Api; using Bit.Api.Vault.Models.Response;
using Bit.Core.Models.Api;
namespace Bit.Api.Models.Response; namespace Bit.Api.Models.Response;

View File

@ -4,6 +4,7 @@ using Bit.Api.Models.Public.Response;
using Bit.Core.Context; using Bit.Core.Context;
using Bit.Core.Models.Data; using Bit.Core.Models.Data;
using Bit.Core.Repositories; using Bit.Core.Repositories;
using Bit.Core.Vault.Repositories;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;

View File

@ -1,24 +1,27 @@
using System.Text.Json; using System.Text.Json;
using Azure.Messaging.EventGrid; using Azure.Messaging.EventGrid;
using Bit.Api.Models.Request;
using Bit.Api.Models.Request.Accounts; using Bit.Api.Models.Request.Accounts;
using Bit.Api.Models.Request.Organizations; using Bit.Api.Models.Request.Organizations;
using Bit.Api.Models.Response; using Bit.Api.Models.Response;
using Bit.Api.Utilities; using Bit.Api.Utilities;
using Bit.Api.Vault.Models.Request;
using Bit.Api.Vault.Models.Response;
using Bit.Core; using Bit.Core;
using Bit.Core.Context; using Bit.Core.Context;
using Bit.Core.Entities; using Bit.Core.Entities;
using Bit.Core.Exceptions; using Bit.Core.Exceptions;
using Bit.Core.Models.Data;
using Bit.Core.Repositories; using Bit.Core.Repositories;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Core.Models.Data; using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
using Bit.Core.Vault.Repositories;
using Bit.Core.Vault.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Bit.Api.Controllers; namespace Bit.Api.Vault.Controllers;
[Route("ciphers")] [Route("ciphers")]
[Authorize("Application")] [Authorize("Application")]

View File

@ -1,12 +1,14 @@
using Bit.Api.Models.Request; using Bit.Api.Models.Response;
using Bit.Api.Models.Response; using Bit.Api.Vault.Models.Request;
using Bit.Api.Vault.Models.Response;
using Bit.Core.Exceptions; using Bit.Core.Exceptions;
using Bit.Core.Repositories;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Vault.Repositories;
using Bit.Core.Vault.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Bit.Api.Controllers; namespace Bit.Api.Vault.Controllers;
[Route("folders")] [Route("folders")]
[Authorize("Application")] [Authorize("Application")]

View File

@ -1,4 +1,4 @@
using Bit.Api.Models.Response; using Bit.Api.Vault.Models.Response;
using Bit.Core.Entities; using Bit.Core.Entities;
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Enums.Provider; using Bit.Core.Enums.Provider;
@ -7,10 +7,11 @@ using Bit.Core.Models.Data;
using Bit.Core.Repositories; using Bit.Core.Repositories;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Vault.Repositories;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Bit.Api.Controllers; namespace Bit.Api.Vault.Controllers;
[Route("sync")] [Route("sync")]
[Authorize("Application")] [Authorize("Application")]

View File

@ -1,7 +1,7 @@
using Bit.Core.Models.Data; using Bit.Core.Utilities;
using Bit.Core.Utilities; using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models; namespace Bit.Api.Vault.Models;
public class CipherAttachmentModel public class CipherAttachmentModel
{ {

View File

@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Bit.Core.Models.Data;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models; namespace Bit.Api.Vault.Models;
public class CipherCardModel public class CipherCardModel
{ {

View File

@ -1,8 +1,8 @@
using Bit.Core.Enums; using Bit.Core.Utilities;
using Bit.Core.Models.Data; using Bit.Core.Vault.Enums;
using Bit.Core.Utilities; using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models; namespace Bit.Api.Vault.Models;
public class CipherFieldModel public class CipherFieldModel
{ {

View File

@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Bit.Core.Models.Data;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models; namespace Bit.Api.Vault.Models;
public class CipherIdentityModel public class CipherIdentityModel
{ {

View File

@ -1,8 +1,8 @@
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models; namespace Bit.Api.Vault.Models;
public class CipherLoginModel public class CipherLoginModel
{ {

View File

@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Bit.Core.Models.Data;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models; namespace Bit.Api.Vault.Models;
public class CipherPasswordHistoryModel public class CipherPasswordHistoryModel
{ {

View File

@ -1,7 +1,7 @@
using Bit.Core.Enums; using Bit.Core.Vault.Enums;
using Bit.Core.Models.Data; using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models; namespace Bit.Api.Vault.Models;
public class CipherSecureNoteModel public class CipherSecureNoteModel
{ {

View File

@ -1,4 +1,4 @@
namespace Bit.Api.Models.Request; namespace Bit.Api.Vault.Models.Request;
public class AttachmentRequestModel public class AttachmentRequestModel
{ {

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace Bit.Api.Models.Request; namespace Bit.Api.Vault.Models.Request;
public class CipherPartialRequestModel public class CipherPartialRequestModel
{ {

View File

@ -1,14 +1,13 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Text.Json; using System.Text.Json;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Core.Models.Data; using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Enums;
using Bit.Core.Vault.Models.Data;
using NS = Newtonsoft.Json; using NS = Newtonsoft.Json;
using NSL = Newtonsoft.Json.Linq; using NSL = Newtonsoft.Json.Linq;
namespace Bit.Api.Models.Request; namespace Bit.Api.Vault.Models.Request;
public class CipherRequestModel public class CipherRequestModel
{ {

View File

@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Bit.Core.Entities;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
namespace Bit.Api.Models.Request; namespace Bit.Api.Vault.Models.Request;
public class FolderRequestModel public class FolderRequestModel
{ {

View File

@ -1,11 +1,11 @@
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Bit.Core.Entities;
using Bit.Core.Models.Api; using Bit.Core.Models.Api;
using Bit.Core.Models.Data;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models.Response; namespace Bit.Api.Vault.Models.Response;
public class AttachmentResponseModel : ResponseModel public class AttachmentResponseModel : ResponseModel
{ {

View File

@ -1,7 +1,7 @@
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Models.Api; using Bit.Core.Models.Api;
namespace Bit.Api.Models.Response; namespace Bit.Api.Vault.Models.Response;
public class AttachmentUploadDataResponseModel : ResponseModel public class AttachmentUploadDataResponseModel : ResponseModel
{ {

View File

@ -1,12 +1,12 @@
using System.Text.Json; using System.Text.Json;
using Bit.Core.Entities; using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Api; using Bit.Core.Models.Api;
using Bit.Core.Models.Data;
using Bit.Core.Settings; using Bit.Core.Settings;
using Core.Models.Data; using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Enums;
using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models.Response; namespace Bit.Api.Vault.Models.Response;
public class CipherMiniResponseModel : ResponseModel public class CipherMiniResponseModel : ResponseModel
{ {

View File

@ -1,7 +1,7 @@
using Bit.Core.Entities; using Bit.Core.Models.Api;
using Bit.Core.Models.Api; using Bit.Core.Vault.Entities;
namespace Bit.Api.Models.Response; namespace Bit.Api.Vault.Models.Response;
public class FolderResponseModel : ResponseModel public class FolderResponseModel : ResponseModel
{ {

View File

@ -1,11 +1,13 @@
using Bit.Core.Entities; using Bit.Api.Models.Response;
using Bit.Core.Entities;
using Bit.Core.Models.Api; using Bit.Core.Models.Api;
using Bit.Core.Models.Data; using Bit.Core.Models.Data;
using Bit.Core.Models.Data.Organizations.OrganizationUsers; using Bit.Core.Models.Data.Organizations.OrganizationUsers;
using Bit.Core.Settings; using Bit.Core.Settings;
using Core.Models.Data; using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Models.Response; namespace Bit.Api.Vault.Models.Response;
public class SyncResponseModel : ResponseModel public class SyncResponseModel : ResponseModel
{ {

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> public class Folder : ITableObject<Guid>
{ {

View File

@ -1,5 +1,5 @@
using Bit.Core.Entities; using Bit.Core.Entities;
using Core.Models.Data; using Bit.Core.Vault.Models.Data;
namespace Bit.Core.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; 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.Settings;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
using Microsoft.Azure.Cosmos.Table; using Microsoft.Azure.Cosmos.Table;
namespace Bit.Core.Repositories.TableStorage; namespace Bit.Core.Repositories.TableStorage;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,9 @@
using System.Text.Json; using System.Text.Json;
using Bit.Core.Models.Data; using Bit.Core.Entities;
using Bit.Core.Utilities; 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 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 public enum CipherRepromptType : byte
{ {

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Enums; namespace Bit.Core.Vault.Enums;
public enum SecureNoteType : byte 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 public class AttachmentResponseData
{ {

View File

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

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Models.Data; namespace Bit.Core.Vault.Models.Data;
public class CipherCardData : CipherData 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 public abstract class CipherData
{ {

View File

@ -1,4 +1,4 @@
namespace Core.Models.Data; namespace Bit.Core.Vault.Models.Data;
public class CipherDetails : CipherOrganizationDetails 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 public class CipherFieldData
{ {

View File

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

View File

@ -1,6 +1,6 @@
using Bit.Core.Enums; using Bit.Core.Enums;
namespace Bit.Core.Models.Data; namespace Bit.Core.Vault.Models.Data;
public class CipherLoginData : CipherData 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 public class CipherOrganizationDetails : Cipher
{ {

View File

@ -1,4 +1,4 @@
namespace Bit.Core.Models.Data; namespace Bit.Core.Vault.Models.Data;
public class CipherPasswordHistoryData 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 public class CipherSecureNoteData : CipherData
{ {

View File

@ -1,8 +1,9 @@
using Bit.Core.Entities; using Bit.Core.Entities;
using Bit.Core.Models.Data; using Bit.Core.Repositories;
using Core.Models.Data; 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> 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> public interface IFolderRepository : IRepository<Folder, Guid>
{ {

View File

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

View File

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

View File

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

View File

@ -1,9 +1,10 @@
using Bit.Core.Entities; using Bit.Core.Enums;
using Bit.Core.Enums; using Bit.Core.Services;
using Bit.Core.Models.Data;
using Bit.Core.Settings; 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 public class LocalAttachmentStorageService : IAttachmentStorageService
{ {

View File

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

View File

@ -1,8 +1,9 @@
using Bit.Core.Context; using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Repositories; using Bit.Core.Repositories;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Repositories;
using Bit.Events.Models; using Bit.Events.Models;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;

View File

@ -1,7 +1,9 @@
using Bit.Core.Repositories; using Bit.Core.Repositories;
using Bit.Core.SecretsManager.Repositories; using Bit.Core.SecretsManager.Repositories;
using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.Dapper.Repositories; using Bit.Infrastructure.Dapper.Repositories;
using Bit.Infrastructure.Dapper.SecretsManager.Repositories; using Bit.Infrastructure.Dapper.SecretsManager.Repositories;
using Bit.Infrastructure.Dapper.Vault.Repositories;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Bit.Infrastructure.Dapper; namespace Bit.Infrastructure.Dapper;

View File

@ -3,6 +3,7 @@ using Bit.Core.Entities;
using Bit.Core.Models.Data; using Bit.Core.Models.Data;
using Bit.Core.Repositories; using Bit.Core.Repositories;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Vault.Entities;
using Dapper; using Dapper;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;

View File

@ -1,14 +1,15 @@
using System.Data; using System.Data;
using System.Text.Json; using System.Text.Json;
using Bit.Core.Entities; using Bit.Core.Entities;
using Bit.Core.Models.Data;
using Bit.Core.Repositories;
using Bit.Core.Settings; using Bit.Core.Settings;
using Core.Models.Data; using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.Dapper.Repositories;
using Dapper; using Dapper;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
namespace Bit.Infrastructure.Dapper.Repositories; namespace Bit.Infrastructure.Dapper.Vault.Repositories;
public class CipherRepository : Repository<Cipher, Guid>, ICipherRepository public class CipherRepository : Repository<Cipher, Guid>, ICipherRepository
{ {

View File

@ -1,11 +1,12 @@
using System.Data; using System.Data;
using Bit.Core.Entities;
using Bit.Core.Repositories;
using Bit.Core.Settings; using Bit.Core.Settings;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.Dapper.Repositories;
using Dapper; using Dapper;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
namespace Bit.Infrastructure.Dapper.Repositories; namespace Bit.Infrastructure.Dapper.Vault.Repositories;
public class FolderRepository : Repository<Folder, Guid>, IFolderRepository public class FolderRepository : Repository<Folder, Guid>, IFolderRepository
{ {

View File

@ -1,8 +1,10 @@
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Repositories; using Bit.Core.Repositories;
using Bit.Core.SecretsManager.Repositories; using Bit.Core.SecretsManager.Repositories;
using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Infrastructure.EntityFramework.SecretsManager.Repositories; using Bit.Infrastructure.EntityFramework.SecretsManager.Repositories;
using Bit.Infrastructure.EntityFramework.Vault.Repositories;
using LinqToDB.EntityFrameworkCore; using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;

View File

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

View File

@ -1,16 +0,0 @@
using AutoMapper;
namespace Bit.Infrastructure.EntityFramework.Models;
public class Folder : Core.Entities.Folder
{
public virtual User User { get; set; }
}
public class FolderMapperProfile : Profile
{
public FolderMapperProfile()
{
CreateMap<Core.Entities.Folder, Folder>().ReverseMap();
}
}

View File

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

View File

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

View File

@ -2,6 +2,7 @@
using Bit.Infrastructure.EntityFramework.Converters; using Bit.Infrastructure.EntityFramework.Converters;
using Bit.Infrastructure.EntityFramework.Models; using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Bit.Infrastructure.EntityFramework.SecretsManager.Models;
using Bit.Infrastructure.EntityFramework.Vault.Models;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

View File

@ -6,7 +6,7 @@ using Bit.Infrastructure.EntityFramework.Repositories.Queries;
using LinqToDB.EntityFrameworkCore; using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Cipher = Bit.Core.Entities.Cipher; using Cipher = Bit.Core.Vault.Entities.Cipher;
namespace Bit.Infrastructure.EntityFramework.Repositories; namespace Bit.Infrastructure.EntityFramework.Repositories;

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;
using Event = Bit.Infrastructure.EntityFramework.Models.Event; using Event = Bit.Infrastructure.EntityFramework.Models.Event;
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; namespace Bit.Infrastructure.EntityFramework.Repositories.Queries;

View File

@ -1,6 +1,7 @@
using System.Text.Json; using System.Text.Json;
using Bit.Core.Enums; using Bit.Core.Enums;
using Core.Models.Data; using Bit.Core.Vault.Models.Data;
using Bit.Infrastructure.EntityFramework.Vault.Models;
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; namespace Bit.Infrastructure.EntityFramework.Repositories.Queries;
@ -76,7 +77,7 @@ public class UserCipherDetailsQuery : IQuery<CipherDetails>
return union; return union;
} }
private static Guid? GetFolderId(Guid? userId, Models.Cipher cipher) private static Guid? GetFolderId(Guid? userId, Cipher cipher)
{ {
if (userId.HasValue && !string.IsNullOrWhiteSpace(cipher.Folders)) if (userId.HasValue && !string.IsNullOrWhiteSpace(cipher.Folders))
{ {

View File

@ -1,8 +1,9 @@
using AutoMapper; using AutoMapper;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.Models; namespace Bit.Infrastructure.EntityFramework.Vault.Models;
public class Cipher : Core.Entities.Cipher public class Cipher : Core.Vault.Entities.Cipher
{ {
public virtual User User { get; set; } public virtual User User { get; set; }
public virtual Organization Organization { get; set; } public virtual Organization Organization { get; set; }
@ -13,6 +14,6 @@ public class CipherMapperProfile : Profile
{ {
public CipherMapperProfile() public CipherMapperProfile()
{ {
CreateMap<Core.Entities.Cipher, Cipher>().ReverseMap(); CreateMap<Core.Vault.Entities.Cipher, Cipher>().ReverseMap();
} }
} }

View File

@ -0,0 +1,17 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.Vault.Models;
public class Folder : Core.Vault.Entities.Folder
{
public virtual User User { get; set; }
}
public class FolderMapperProfile : Profile
{
public FolderMapperProfile()
{
CreateMap<Core.Vault.Entities.Folder, Folder>().ReverseMap();
}
}

View File

@ -1,11 +1,15 @@
using AutoMapper; using AutoMapper;
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Repositories;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.Core.Vault.Enums;
using Bit.Core.Vault.Models.Data;
using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.EntityFramework.Models; using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Bit.Infrastructure.EntityFramework.Repositories.Queries;
using Core.Models.Data; using Bit.Infrastructure.EntityFramework.Repositories.Vault.Queries;
using Bit.Infrastructure.EntityFramework.Vault.Models;
using Bit.Infrastructure.EntityFramework.Vault.Repositories.Queries;
using LinqToDB.EntityFrameworkCore; using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -13,15 +17,15 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using User = Bit.Core.Entities.User; using User = Bit.Core.Entities.User;
namespace Bit.Infrastructure.EntityFramework.Repositories; namespace Bit.Infrastructure.EntityFramework.Vault.Repositories;
public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>, ICipherRepository public class CipherRepository : Repository<Core.Vault.Entities.Cipher, Cipher, Guid>, ICipherRepository
{ {
public CipherRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) public CipherRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Ciphers) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Ciphers)
{ } { }
public override async Task<Core.Entities.Cipher> CreateAsync(Core.Entities.Cipher cipher) public override async Task<Core.Vault.Entities.Cipher> CreateAsync(Core.Vault.Entities.Cipher cipher)
{ {
cipher = await base.CreateAsync(cipher); cipher = await base.CreateAsync(cipher);
using (var scope = ServiceScopeFactory.CreateScope()) using (var scope = ServiceScopeFactory.CreateScope())
@ -40,7 +44,7 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
return cipher; return cipher;
} }
public override async Task DeleteAsync(Core.Entities.Cipher cipher) public override async Task DeleteAsync(Core.Vault.Entities.Cipher cipher)
{ {
using (var scope = ServiceScopeFactory.CreateScope()) using (var scope = ServiceScopeFactory.CreateScope())
{ {
@ -74,7 +78,7 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
} }
} }
public async Task CreateAsync(Core.Entities.Cipher cipher, IEnumerable<Guid> collectionIds) public async Task CreateAsync(Core.Vault.Entities.Cipher cipher, IEnumerable<Guid> collectionIds)
{ {
cipher = await CreateAsync(cipher); cipher = await CreateAsync(cipher);
using (var scope = ServiceScopeFactory.CreateScope()) using (var scope = ServiceScopeFactory.CreateScope())
@ -105,7 +109,7 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
cipher.Folders = cipher.FolderId.HasValue ? cipher.Folders = cipher.FolderId.HasValue ?
$"{{{userIdKey}:\"{cipher.FolderId}\"}}" : $"{{{userIdKey}:\"{cipher.FolderId}\"}}" :
null; null;
var entity = Mapper.Map<Cipher>((Core.Entities.Cipher)cipher); var entity = Mapper.Map<Cipher>((Core.Vault.Entities.Cipher)cipher);
await dbContext.AddAsync(entity); await dbContext.AddAsync(entity);
if (cipher.OrganizationId.HasValue) if (cipher.OrganizationId.HasValue)
@ -134,7 +138,7 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
} }
} }
public async Task CreateAsync(IEnumerable<Core.Entities.Cipher> ciphers, IEnumerable<Core.Entities.Folder> folders) public async Task CreateAsync(IEnumerable<Core.Vault.Entities.Cipher> ciphers, IEnumerable<Core.Vault.Entities.Folder> folders)
{ {
if (!ciphers.Any()) if (!ciphers.Any())
{ {
@ -153,7 +157,7 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
} }
} }
public async Task CreateAsync(IEnumerable<Core.Entities.Cipher> ciphers, IEnumerable<Core.Entities.Collection> collections, IEnumerable<Core.Entities.CollectionCipher> collectionCiphers) public async Task CreateAsync(IEnumerable<Core.Vault.Entities.Cipher> ciphers, IEnumerable<Core.Entities.Collection> collections, IEnumerable<Core.Entities.CollectionCipher> collectionCiphers)
{ {
if (!ciphers.Any()) if (!ciphers.Any())
{ {
@ -317,14 +321,14 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
} }
} }
public async Task<ICollection<Core.Entities.Cipher>> GetManyByOrganizationIdAsync(Guid organizationId) public async Task<ICollection<Core.Vault.Entities.Cipher>> GetManyByOrganizationIdAsync(Guid organizationId)
{ {
using (var scope = ServiceScopeFactory.CreateScope()) using (var scope = ServiceScopeFactory.CreateScope())
{ {
var dbContext = GetDatabaseContext(scope); var dbContext = GetDatabaseContext(scope);
var query = dbContext.Ciphers.Where(x => !x.UserId.HasValue && x.OrganizationId == organizationId); var query = dbContext.Ciphers.Where(x => !x.UserId.HasValue && x.OrganizationId == organizationId);
var data = await query.ToListAsync(); var data = await query.ToListAsync();
return Mapper.Map<List<Core.Entities.Cipher>>(data); return Mapper.Map<List<Core.Vault.Entities.Cipher>>(data);
} }
} }
@ -465,7 +469,7 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
cipher.Favorites = JsonConvert.SerializeObject(folders); cipher.Favorites = JsonConvert.SerializeObject(folders);
} }
} }
var mappedEntity = Mapper.Map<Cipher>((Core.Entities.Cipher)cipher); var mappedEntity = Mapper.Map<Cipher>((Core.Vault.Entities.Cipher)cipher);
dbContext.Entry(entity).CurrentValues.SetValues(mappedEntity); dbContext.Entry(entity).CurrentValues.SetValues(mappedEntity);
if (cipher.OrganizationId.HasValue) if (cipher.OrganizationId.HasValue)
@ -545,7 +549,7 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
return 0; return 0;
} }
public async Task<bool> ReplaceAsync(Core.Entities.Cipher cipher, IEnumerable<Guid> collectionIds) public async Task<bool> ReplaceAsync(Core.Vault.Entities.Cipher cipher, IEnumerable<Guid> collectionIds)
{ {
using (var scope = ServiceScopeFactory.CreateScope()) using (var scope = ServiceScopeFactory.CreateScope())
{ {
@ -714,7 +718,7 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
} }
} }
public async Task UpdateCiphersAsync(Guid userId, IEnumerable<Core.Entities.Cipher> ciphers) public async Task UpdateCiphersAsync(Guid userId, IEnumerable<Core.Vault.Entities.Cipher> ciphers)
{ {
if (!ciphers.Any()) if (!ciphers.Any())
{ {
@ -766,7 +770,7 @@ public class CipherRepository : Repository<Core.Entities.Cipher, Cipher, Guid>,
} }
} }
public async Task UpdateUserKeysAndCiphersAsync(User user, IEnumerable<Core.Entities.Cipher> ciphers, IEnumerable<Core.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.Entities.Send> sends)
{ {
using (var scope = ServiceScopeFactory.CreateScope()) using (var scope = ServiceScopeFactory.CreateScope())
{ {

View File

@ -1,18 +1,19 @@
using AutoMapper; using AutoMapper;
using Bit.Core.Repositories; using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.EntityFramework.Models; using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Infrastructure.EntityFramework.Vault.Models;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Bit.Infrastructure.EntityFramework.Repositories; namespace Bit.Infrastructure.EntityFramework.Vault.Repositories;
public class FolderRepository : Repository<Core.Entities.Folder, Folder, Guid>, IFolderRepository public class FolderRepository : Repository<Core.Vault.Entities.Folder, Folder, Guid>, IFolderRepository
{ {
public FolderRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) public FolderRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Folders) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Folders)
{ } { }
public async Task<Core.Entities.Folder> GetByIdAsync(Guid id, Guid userId) public async Task<Core.Vault.Entities.Folder> GetByIdAsync(Guid id, Guid userId)
{ {
var folder = await base.GetByIdAsync(id); var folder = await base.GetByIdAsync(id);
if (folder == null || folder.UserId != userId) if (folder == null || folder.UserId != userId)
@ -23,7 +24,7 @@ public class FolderRepository : Repository<Core.Entities.Folder, Folder, Guid>,
return folder; return folder;
} }
public async Task<ICollection<Core.Entities.Folder>> GetManyByUserIdAsync(Guid userId) public async Task<ICollection<Core.Vault.Entities.Folder>> GetManyByUserIdAsync(Guid userId)
{ {
using (var scope = ServiceScopeFactory.CreateScope()) using (var scope = ServiceScopeFactory.CreateScope())
{ {
@ -32,7 +33,7 @@ public class FolderRepository : Repository<Core.Entities.Folder, Folder, Guid>,
where f.UserId == userId where f.UserId == userId
select f; select f;
var folders = await query.ToListAsync(); var folders = await query.ToListAsync();
return Mapper.Map<List<Core.Entities.Folder>>(folders); return Mapper.Map<List<Core.Vault.Entities.Folder>>(folders);
} }
} }
} }

View File

@ -1,7 +1,9 @@
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Core.Models.Data; using Bit.Core.Vault.Models.Data;
using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Infrastructure.EntityFramework.Repositories.Queries;
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; namespace Bit.Infrastructure.EntityFramework.Vault.Repositories.Queries;
public class CipherDetailsQuery : IQuery<CipherDetails> public class CipherDetailsQuery : IQuery<CipherDetails>
{ {

View File

@ -1,6 +1,8 @@
using Core.Models.Data; using Bit.Core.Vault.Models.Data;
using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Infrastructure.EntityFramework.Repositories.Queries;
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; namespace Bit.Infrastructure.EntityFramework.Vault.Repositories.Queries;
public class CipherOrganizationDetailsReadByIdQuery : IQuery<CipherOrganizationDetails> public class CipherOrganizationDetailsReadByIdQuery : IQuery<CipherOrganizationDetails>
{ {

Some files were not shown because too many files have changed in this diff Show More