mirror of
https://github.com/bitwarden/server.git
synced 2025-07-06 02:22:49 -05:00
[AC-1287] AC Team code ownership moves: Policies (1/2) (#3383)
* note: IPolicyData and EntityFramework Policy.cs are moved without any changes to namespace or content in order to preserve git history.
This commit is contained in:
@ -0,0 +1,5 @@
|
||||
namespace Bit.Core.Models.Data.Organizations.Policies;
|
||||
|
||||
public interface IPolicyDataModel
|
||||
{
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
using Bit.Core.Models.Data.Organizations.Policies;
|
||||
|
||||
namespace Bit.Core.AdminConsole.Models.Data.Organizations.Policies;
|
||||
|
||||
public class MasterPasswordPolicyData : IPolicyDataModel
|
||||
{
|
||||
public int? MinComplexity { get; set; }
|
||||
public int? MinLength { get; set; }
|
||||
public bool? RequireLower { get; set; }
|
||||
public bool? RequireUpper { get; set; }
|
||||
public bool? RequireNumbers { get; set; }
|
||||
public bool? RequireSpecial { get; set; }
|
||||
public bool? EnforceOnLogin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Combine the other policy data with this instance, taking the most secure options
|
||||
/// </summary>
|
||||
/// <param name="other">The other policy instance to combine with this</param>
|
||||
public void CombineWith(MasterPasswordPolicyData other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (other.MinComplexity.HasValue && (!MinComplexity.HasValue || other.MinComplexity > MinComplexity))
|
||||
{
|
||||
MinComplexity = other.MinComplexity;
|
||||
}
|
||||
|
||||
if (other.MinLength.HasValue && (!MinLength.HasValue || other.MinLength > MinLength))
|
||||
{
|
||||
MinLength = other.MinLength;
|
||||
}
|
||||
|
||||
RequireLower = (other.RequireLower ?? false) || (RequireLower ?? false);
|
||||
RequireUpper = (other.RequireUpper ?? false) || (RequireUpper ?? false);
|
||||
RequireNumbers = (other.RequireNumbers ?? false) || (RequireNumbers ?? false);
|
||||
RequireSpecial = (other.RequireSpecial ?? false) || (RequireSpecial ?? false);
|
||||
EnforceOnLogin = (other.EnforceOnLogin ?? false) || (EnforceOnLogin ?? false);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Data.Organizations.Policies;
|
||||
|
||||
namespace Bit.Core.AdminConsole.Models.Data.Organizations.Policies;
|
||||
|
||||
public class ResetPasswordDataModel : IPolicyDataModel
|
||||
{
|
||||
[Display(Name = "ResetPasswordAutoEnrollCheckbox")]
|
||||
public bool AutoEnrollEnabled { get; set; }
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Models.Data.Organizations.Policies;
|
||||
|
||||
namespace Bit.Core.AdminConsole.Models.Data.Organizations.Policies;
|
||||
|
||||
public class SendOptionsPolicyData : IPolicyDataModel
|
||||
{
|
||||
[Display(Name = "DisableHideEmail")]
|
||||
public bool DisableHideEmail { get; set; }
|
||||
}
|
Reference in New Issue
Block a user