mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
Hide email address in Sends (#1234)
* Add send HideEmail to tables and models * Respect HideEmail setting for Sends * Recreate SendView to include new HideEmail column * Enforce new Send policy * Insert default value for new HideEmail column * Delete c95d7598-71cc-4eab-8b08-aced0045198b.json * Remove unrelated files * Revert disableSendPolicy, add sendOptionsPolicy * Minor style fixes * Update SQL project with Send.HideEmail column * unit test SendOptionsPolicy.DisableHideEmail * Add SendOptionsPolicy to Portal * Make HideEmail nullable, fix migrator script * Remove NOT NULL constraint from HideEmail * Fix style * Make HideEmail nullable * minor fixes to model and error message * Move SendOptionsExemption banner Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com>
This commit is contained in:
@ -35,6 +35,7 @@ namespace Bit.Core.Models.Api
|
||||
public string Password { get; set; }
|
||||
[Required]
|
||||
public bool? Disabled { get; set; }
|
||||
public bool? HideEmail { get; set; }
|
||||
|
||||
public Send ToSend(Guid userId, ISendService sendService)
|
||||
{
|
||||
@ -125,6 +126,7 @@ namespace Bit.Core.Models.Api
|
||||
existingSend.Password = sendService.HashPassword(Password);
|
||||
}
|
||||
existingSend.Disabled = Disabled.GetValueOrDefault();
|
||||
existingSend.HideEmail = HideEmail.GetValueOrDefault();
|
||||
return existingSend;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ namespace Bit.Core.Models.Api
|
||||
DeletionDate = send.DeletionDate;
|
||||
Password = send.Password;
|
||||
Disabled = send.Disabled;
|
||||
HideEmail = send.HideEmail.GetValueOrDefault();
|
||||
|
||||
SendData sendData;
|
||||
switch (send.Type)
|
||||
@ -66,5 +67,6 @@ namespace Bit.Core.Models.Api
|
||||
public DateTime RevisionDate { get; set; }
|
||||
public DateTime? ExpirationDate { get; set; }
|
||||
public DateTime DeletionDate { get; set; }
|
||||
public bool HideEmail { get; set; }
|
||||
}
|
||||
}
|
||||
|
10
src/Core/Models/Data/SendOptionsPolicyData.cs
Normal file
10
src/Core/Models/Data/SendOptionsPolicyData.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class SendOptionsPolicyData
|
||||
{
|
||||
[Display(Name = "DisableHideEmail")]
|
||||
public bool DisableHideEmail { get; set; }
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ namespace Bit.Core.Models.Table
|
||||
public DateTime? ExpirationDate { get; set; }
|
||||
public DateTime DeletionDate { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
public bool? HideEmail { get; set; }
|
||||
|
||||
public void SetNewId()
|
||||
{
|
||||
|
Reference in New Issue
Block a user