mirror of
https://github.com/bitwarden/server.git
synced 2024-11-29 13:25:17 +01:00
Make properties init-only
This commit is contained in:
parent
5bb005354b
commit
72a47edceb
@ -10,8 +10,8 @@ namespace Bit.Core.AdminConsole.Entities;
|
||||
public class Policy : ITableObject<Guid>
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid OrganizationId { get; set; }
|
||||
public PolicyType Type { get; set; }
|
||||
public Guid OrganizationId { get; init; }
|
||||
public PolicyType Type { get; init; }
|
||||
public string? Data { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
|
||||
|
@ -15,6 +15,7 @@ using Xunit;
|
||||
using EfAdminConsoleRepo = Bit.Infrastructure.EntityFramework.AdminConsole.Repositories;
|
||||
using EfRepo = Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using OrganizationUser = Bit.Core.Entities.OrganizationUser;
|
||||
using Policy = Bit.Infrastructure.EntityFramework.AdminConsole.Models.Policy;
|
||||
using SqlAdminConsoleRepo = Bit.Infrastructure.Dapper.AdminConsole.Repositories;
|
||||
using SqlRepo = Bit.Infrastructure.Dapper.Repositories;
|
||||
|
||||
@ -175,7 +176,6 @@ public class OrganizationUserRepositoryTests
|
||||
bool isProvider,
|
||||
|
||||
// Auto data - models
|
||||
Policy policy,
|
||||
User user,
|
||||
Organization organization,
|
||||
OrganizationUser orgUser,
|
||||
@ -220,8 +220,6 @@ public class OrganizationUserRepositoryTests
|
||||
providerUserRepos.Add(sqlProviderUserRepo);
|
||||
|
||||
// Arrange data
|
||||
var savedPolicyType = PolicyType.SingleOrg;
|
||||
|
||||
orgUser.Type = userType;
|
||||
orgUser.Status = orgUserStatus;
|
||||
var permissionsData = new Permissions { ManagePolicies = canManagePolicies };
|
||||
@ -230,9 +228,6 @@ public class OrganizationUserRepositoryTests
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
});
|
||||
|
||||
policy.Enabled = policyEnabled;
|
||||
policy.Type = savedPolicyType;
|
||||
|
||||
var results = new List<OrganizationUserPolicyDetails>();
|
||||
|
||||
foreach (var policyRepo in policyRepos)
|
||||
@ -271,7 +266,11 @@ public class OrganizationUserRepositoryTests
|
||||
await providerUserRepos[i].CreateAsync(providerUser);
|
||||
}
|
||||
|
||||
policy.OrganizationId = savedOrg.Id;
|
||||
var policy = new Core.AdminConsole.Entities.Policy
|
||||
{
|
||||
Enabled = policyEnabled, Type = PolicyType.SingleOrg, OrganizationId = savedOrg.Id
|
||||
};
|
||||
|
||||
await policyRepo.CreateAsync(policy);
|
||||
if (efPolicyRepository.Contains(policyRepo))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user