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:
parent
05f5d79938
commit
3289a8c35e
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -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
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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")]
|
@ -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")]
|
@ -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")]
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Api.Models.Request;
|
namespace Bit.Api.Vault.Models.Request;
|
||||||
|
|
||||||
public class AttachmentRequestModel
|
public class AttachmentRequestModel
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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>
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Core.Enums;
|
namespace Bit.Core.Vault.Enums;
|
||||||
|
|
||||||
public enum CipherRepromptType : byte
|
public enum CipherRepromptType : byte
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Core.Enums;
|
namespace Bit.Core.Vault.Enums;
|
||||||
|
|
||||||
public enum CipherStateAction
|
public enum CipherStateAction
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Core.Enums;
|
namespace Bit.Core.Vault.Enums;
|
||||||
|
|
||||||
public enum CipherType : byte
|
public enum CipherType : byte
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Core.Enums;
|
namespace Bit.Core.Vault.Enums;
|
||||||
|
|
||||||
public enum FieldType : byte
|
public enum FieldType : byte
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Core.Enums;
|
namespace Bit.Core.Vault.Enums;
|
||||||
|
|
||||||
public enum SecureNoteType : byte
|
public enum SecureNoteType : byte
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Core.Models.Data;
|
namespace Bit.Core.Vault.Models.Data;
|
||||||
|
|
||||||
public class CipherCardData : CipherData
|
public class CipherCardData : CipherData
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Core.Models.Data;
|
namespace Bit.Core.Vault.Models.Data;
|
||||||
|
|
||||||
public abstract class CipherData
|
public abstract class CipherData
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Core.Models.Data;
|
namespace Bit.Core.Vault.Models.Data;
|
||||||
|
|
||||||
public class CipherDetails : CipherOrganizationDetails
|
public class CipherDetails : CipherOrganizationDetails
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Core.Models.Data;
|
namespace Bit.Core.Vault.Models.Data;
|
||||||
|
|
||||||
public class CipherIdentityData : CipherData
|
public class CipherIdentityData : CipherData
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace Bit.Core.Models.Data;
|
namespace Bit.Core.Vault.Models.Data;
|
||||||
|
|
||||||
public class CipherPasswordHistoryData
|
public class CipherPasswordHistoryData
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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>
|
||||||
{
|
{
|
@ -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>
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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);
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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
|
||||||
{
|
{
|
@ -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
|
||||||
{
|
{
|
@ -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;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using Bit.Infrastructure.EntityFramework.Vault.Models;
|
||||||
|
|
||||||
namespace Bit.Infrastructure.EntityFramework.Models;
|
namespace Bit.Infrastructure.EntityFramework.Models;
|
||||||
|
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,5 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using Bit.Infrastructure.EntityFramework.Vault.Models;
|
||||||
|
|
||||||
namespace Bit.Infrastructure.EntityFramework.Models;
|
namespace Bit.Infrastructure.EntityFramework.Models;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using Bit.Infrastructure.EntityFramework.Vault.Models;
|
||||||
|
|
||||||
namespace Bit.Infrastructure.EntityFramework.Models;
|
namespace Bit.Infrastructure.EntityFramework.Models;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
17
src/Infrastructure.EntityFramework/Vault/Models/Folder.cs
Normal file
17
src/Infrastructure.EntityFramework/Vault/Models/Folder.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
@ -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())
|
||||||
{
|
{
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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>
|
||||||
{
|
{
|
@ -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
Loading…
Reference in New Issue
Block a user