mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
[PM-14373] Introduce SecurityTask database table and repository (#5025)
* [PM-14373] Introduce SecurityTask entity and related enums * [PM-14373] Add Dapper SecurityTask repository * [PM-14373] Introduce MSSQL table, view, and stored procedures * [PM-14373] Add EF SecurityTask repository and type configurations * [PM-14373] Add EF Migration * [PM-14373] Add integration tests * [PM-14373] Formatting * Typo Co-authored-by: Matt Bishop <mbishop@bitwarden.com> * Typo Co-authored-by: Matt Bishop <mbishop@bitwarden.com> * [PM-14373] Remove DeleteById sproc * [PM-14373] SQL formatting --------- Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
This commit is contained in:
20
src/Core/Vault/Entities/SecurityTask.cs
Normal file
20
src/Core/Vault/Entities/SecurityTask.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Vault.Entities;
|
||||
|
||||
public class SecurityTask : ITableObject<Guid>
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid OrganizationId { get; set; }
|
||||
public Guid? CipherId { get; set; }
|
||||
public Enums.SecurityTaskType Type { get; set; }
|
||||
public Enums.SecurityTaskStatus Status { get; set; }
|
||||
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
||||
public DateTime RevisionDate { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public void SetNewId()
|
||||
{
|
||||
Id = CoreHelpers.GenerateComb();
|
||||
}
|
||||
}
|
18
src/Core/Vault/Enums/SecurityTaskStatus.cs
Normal file
18
src/Core/Vault/Enums/SecurityTaskStatus.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Vault.Enums;
|
||||
|
||||
public enum SecurityTaskStatus : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Default status for newly created tasks that have not been completed.
|
||||
/// </summary>
|
||||
[Display(Name = "Pending")]
|
||||
Pending = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Status when a task is considered complete and has no remaining actions
|
||||
/// </summary>
|
||||
[Display(Name = "Completed")]
|
||||
Completed = 1,
|
||||
}
|
12
src/Core/Vault/Enums/SecurityTaskType.cs
Normal file
12
src/Core/Vault/Enums/SecurityTaskType.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Vault.Enums;
|
||||
|
||||
public enum SecurityTaskType : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Task to update a cipher's password that was found to be at-risk by an administrator
|
||||
/// </summary>
|
||||
[Display(Name = "Update at-risk credential")]
|
||||
UpdateAtRiskCredential = 0
|
||||
}
|
9
src/Core/Vault/Repositories/ISecurityTaskRepository.cs
Normal file
9
src/Core/Vault/Repositories/ISecurityTaskRepository.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Vault.Entities;
|
||||
|
||||
namespace Bit.Core.Vault.Repositories;
|
||||
|
||||
public interface ISecurityTaskRepository : IRepository<SecurityTask, Guid>
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user