From dac8f66a598d2369af81e6d55dc79489e58d3365 Mon Sep 17 00:00:00 2001
From: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Date: Fri, 22 Nov 2024 16:05:15 -0500
Subject: [PATCH] Resolve AC Warnings (#4644)
* Resolve AC Warnings
* Remove Unneeded Changes
* Add Back RequiredAttribute
* Format
---
src/Admin/AdminConsole/Models/OrganizationEditModel.cs | 2 +-
src/Api/AdminConsole/Public/Models/MemberBaseModel.cs | 9 ++++++---
.../Public/Models/Response/MemberResponseModel.cs | 3 +++
.../Models/Mail/Provider/ProviderInitiateDeleteModel.cs | 2 --
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/Admin/AdminConsole/Models/OrganizationEditModel.cs b/src/Admin/AdminConsole/Models/OrganizationEditModel.cs
index 4ba22130f..48340df70 100644
--- a/src/Admin/AdminConsole/Models/OrganizationEditModel.cs
+++ b/src/Admin/AdminConsole/Models/OrganizationEditModel.cs
@@ -143,7 +143,7 @@ public class OrganizationEditModel : OrganizationViewModel
[Display(Name = "SCIM")]
public bool UseScim { get; set; }
[Display(Name = "Secrets Manager")]
- public bool UseSecretsManager { get; set; }
+ public new bool UseSecretsManager { get; set; }
[Display(Name = "Self Host")]
public bool SelfHost { get; set; }
[Display(Name = "Users Get Premium")]
diff --git a/src/Api/AdminConsole/Public/Models/MemberBaseModel.cs b/src/Api/AdminConsole/Public/Models/MemberBaseModel.cs
index c56117ae7..dc3f91d49 100644
--- a/src/Api/AdminConsole/Public/Models/MemberBaseModel.cs
+++ b/src/Api/AdminConsole/Public/Models/MemberBaseModel.cs
@@ -1,8 +1,11 @@
using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
+#nullable enable
+
namespace Bit.Api.AdminConsole.Public.Models;
public abstract class MemberBaseModel
@@ -25,6 +28,7 @@ public abstract class MemberBaseModel
}
}
+ [SetsRequiredMembers]
public MemberBaseModel(OrganizationUserUserDetails user)
{
if (user == null)
@@ -46,14 +50,13 @@ public abstract class MemberBaseModel
///
[Required]
[EnumDataType(typeof(OrganizationUserType))]
- public OrganizationUserType? Type { get; set; }
+ public required OrganizationUserType? Type { get; set; }
///
/// External identifier for reference or linking this member to another system, such as a user directory.
///
/// external_id_123456
[StringLength(300)]
- public string ExternalId { get; set; }
-
+ public string? ExternalId { get; set; }
///
/// The member's custom permissions if the member has a Custom role. If not supplied, all custom permissions will
/// default to false.
diff --git a/src/Api/AdminConsole/Public/Models/Response/MemberResponseModel.cs b/src/Api/AdminConsole/Public/Models/Response/MemberResponseModel.cs
index ab6ecbca4..499c27cfc 100644
--- a/src/Api/AdminConsole/Public/Models/Response/MemberResponseModel.cs
+++ b/src/Api/AdminConsole/Public/Models/Response/MemberResponseModel.cs
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using Bit.Api.Models.Public.Response;
using Bit.Core.Entities;
@@ -16,6 +17,7 @@ public class MemberResponseModel : MemberBaseModel, IResponseModel
[JsonConstructor]
public MemberResponseModel() { }
+ [SetsRequiredMembers]
public MemberResponseModel(OrganizationUser user, IEnumerable collections) : base(user)
{
if (user == null)
@@ -31,6 +33,7 @@ public class MemberResponseModel : MemberBaseModel, IResponseModel
ResetPasswordEnrolled = user.ResetPasswordKey != null;
}
+ [SetsRequiredMembers]
public MemberResponseModel(OrganizationUserUserDetails user, bool twoFactorEnabled,
IEnumerable collections) : base(user)
{
diff --git a/src/Core/Models/Mail/Provider/ProviderInitiateDeleteModel.cs b/src/Core/Models/Mail/Provider/ProviderInitiateDeleteModel.cs
index 196decb5e..a5071527f 100644
--- a/src/Core/Models/Mail/Provider/ProviderInitiateDeleteModel.cs
+++ b/src/Core/Models/Mail/Provider/ProviderInitiateDeleteModel.cs
@@ -8,10 +8,8 @@ public class ProviderInitiateDeleteModel : BaseMailModel
Token,
ProviderNameUrlEncoded);
- public string WebVaultUrl { get; set; }
public string Token { get; set; }
public Guid ProviderId { get; set; }
- public string SiteName { get; set; }
public string ProviderName { get; set; }
public string ProviderNameUrlEncoded { get; set; }
public string ProviderBillingEmail { get; set; }