1
0
mirror of https://github.com/bitwarden/server synced 2026-01-07 19:13:50 +00:00

PM-2944] Make Entities Nullable In Admin Console (#4386)

* Enable `nullable` in `ISubscriber`

* Enable `nullable` in `Group`

* Enable `nullable` in `GroupUser`

* Enable `nullable` in `Organization`

* Enable `nullable` in `OrganizationUser`

* Enable `nullable` in `Policy`

* Enable `nullable` in `Provider`

* Enable `nullable` in `ProviderOrganization`

* Enable `nullable` in `ProviderUser`

* Update Tests

* Formatting

* Update TwoFactor Tests

* Fix Scim Tests

* Format

* Add Migrations

* Format
This commit is contained in:
Justin Baur
2024-07-04 21:14:37 -04:00
committed by GitHub
parent 7da37ee231
commit 8b5f65fc00
22 changed files with 9874 additions and 62 deletions

View File

@@ -4,6 +4,8 @@ using Bit.Core.Models;
using Bit.Core.Models.Data;
using Bit.Core.Utilities;
#nullable enable
namespace Bit.Core.Entities;
public class OrganizationUser : ITableObject<Guid>, IExternal
@@ -12,17 +14,17 @@ public class OrganizationUser : ITableObject<Guid>, IExternal
public Guid OrganizationId { get; set; }
public Guid? UserId { get; set; }
[MaxLength(256)]
public string Email { get; set; }
public string Key { get; set; }
public string ResetPasswordKey { get; set; }
public string? Email { get; set; }
public string? Key { get; set; }
public string? ResetPasswordKey { get; set; }
public OrganizationUserStatusType Status { get; set; }
public OrganizationUserType Type { get; set; }
public bool AccessAll { get; set; }
[MaxLength(300)]
public string ExternalId { get; set; }
public string? ExternalId { get; set; }
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow;
public string Permissions { get; set; }
public string? Permissions { get; set; }
public bool AccessSecretsManager { get; set; }
public void SetNewId()
@@ -30,7 +32,7 @@ public class OrganizationUser : ITableObject<Guid>, IExternal
Id = CoreHelpers.GenerateComb();
}
public Permissions GetPermissions()
public Permissions? GetPermissions()
{
return string.IsNullOrWhiteSpace(Permissions) ? null
: CoreHelpers.LoadClassFromJsonData<Permissions>(Permissions);