1
0
mirror of https://github.com/bitwarden/server synced 2026-01-11 04:53:18 +00:00
Files
server/src/Api/AdminConsole/Models/Request/Organizations/OrganizationUpdateRequestModel.cs
Thomas Rittson 67534e2cda [PM-29556] Fix: changing organization plan nulls out public and private keys (#6738)
Main fix: only assign new key value where old keys are not set
and new keys have been provided.

Refactors:
- use consistent DTO model for keypairs
- delete duplicate property assignment for new orgs
2025-12-26 10:13:12 +10:00

28 lines
877 B
C#

using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Bit.Core.AdminConsole.OrganizationFeatures.Organizations.Update;
using Bit.Core.Utilities;
namespace Bit.Api.AdminConsole.Models.Request.Organizations;
public class OrganizationUpdateRequestModel
{
[StringLength(50, ErrorMessage = "The field Name exceeds the maximum length.")]
[JsonConverter(typeof(HtmlEncodingStringConverter))]
public string? Name { get; set; }
[EmailAddress]
[StringLength(256)]
public string? BillingEmail { get; set; }
public OrganizationKeysRequestModel? Keys { get; set; }
public OrganizationUpdateRequest ToCommandRequest(Guid organizationId) => new()
{
OrganizationId = organizationId,
Name = Name,
BillingEmail = BillingEmail,
Keys = Keys?.ToPublicKeyEncryptionKeyPairData()
};
}