mirror of
https://github.com/bitwarden/server
synced 2025-12-11 05:43:35 +00:00
* note: IPolicyData and EntityFramework Policy.cs are moved without any changes to namespace or content in order to preserve git history.
23 lines
572 B
C#
23 lines
572 B
C#
using System.Text.Json;
|
|
using Bit.Core.AdminConsole.Entities;
|
|
|
|
namespace Bit.Api.AdminConsole.Public.Models.Request;
|
|
|
|
public class PolicyUpdateRequestModel : PolicyBaseModel
|
|
{
|
|
public Policy ToPolicy(Guid orgId)
|
|
{
|
|
return ToPolicy(new Policy
|
|
{
|
|
OrganizationId = orgId
|
|
});
|
|
}
|
|
|
|
public virtual Policy ToPolicy(Policy existingPolicy)
|
|
{
|
|
existingPolicy.Enabled = Enabled.GetValueOrDefault();
|
|
existingPolicy.Data = Data != null ? JsonSerializer.Serialize(Data) : null;
|
|
return existingPolicy;
|
|
}
|
|
}
|