mirror of
https://github.com/bitwarden/server
synced 2026-01-11 04:53:18 +00:00
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
28 lines
877 B
C#
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()
|
|
};
|
|
}
|