mirror of
https://github.com/bitwarden/server.git
synced 2025-01-06 19:28:08 +01:00
parent
72a47edceb
commit
71629047ad
@ -10,8 +10,8 @@ namespace Bit.Core.AdminConsole.Entities;
|
||||
public class Policy : ITableObject<Guid>
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid OrganizationId { get; init; }
|
||||
public PolicyType Type { get; init; }
|
||||
public Guid OrganizationId { get; set; }
|
||||
public PolicyType Type { get; set; }
|
||||
public string? Data { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
|
||||
|
@ -15,7 +15,6 @@ 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;
|
||||
|
||||
@ -176,6 +175,7 @@ public class OrganizationUserRepositoryTests
|
||||
bool isProvider,
|
||||
|
||||
// Auto data - models
|
||||
Policy policy,
|
||||
User user,
|
||||
Organization organization,
|
||||
OrganizationUser orgUser,
|
||||
@ -220,6 +220,8 @@ public class OrganizationUserRepositoryTests
|
||||
providerUserRepos.Add(sqlProviderUserRepo);
|
||||
|
||||
// Arrange data
|
||||
var savedPolicyType = PolicyType.SingleOrg;
|
||||
|
||||
orgUser.Type = userType;
|
||||
orgUser.Status = orgUserStatus;
|
||||
var permissionsData = new Permissions { ManagePolicies = canManagePolicies };
|
||||
@ -228,6 +230,9 @@ public class OrganizationUserRepositoryTests
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
});
|
||||
|
||||
policy.Enabled = policyEnabled;
|
||||
policy.Type = savedPolicyType;
|
||||
|
||||
var results = new List<OrganizationUserPolicyDetails>();
|
||||
|
||||
foreach (var policyRepo in policyRepos)
|
||||
@ -266,11 +271,7 @@ public class OrganizationUserRepositoryTests
|
||||
await providerUserRepos[i].CreateAsync(providerUser);
|
||||
}
|
||||
|
||||
var policy = new Core.AdminConsole.Entities.Policy
|
||||
{
|
||||
Enabled = policyEnabled, Type = PolicyType.SingleOrg, OrganizationId = savedOrg.Id
|
||||
};
|
||||
|
||||
policy.OrganizationId = savedOrg.Id;
|
||||
await policyRepo.CreateAsync(policy);
|
||||
if (efPolicyRepository.Contains(policyRepo))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user