mirror of
https://github.com/bitwarden/server
synced 2025-12-22 03:03:33 +00:00
Move request/response models (#1754)
This commit is contained in:
24
src/Api/Models/Public/Request/PolicyUpdateRequestModel.cs
Normal file
24
src/Api/Models/Public/Request/PolicyUpdateRequestModel.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Table;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models.Public.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 ? JsonConvert.SerializeObject(Data) : null;
|
||||
return existingPolicy;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user