mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[Provider] Server entities and models (#1370)
* Mock out provider models and service * Implement CreateAsync, CompleteSetupAsync, UpdateAsync, InviteUserAsync and ResendInvitesAsync * Implement AcceptUserAsync and ConfirmUsersAsync * Implement SaveUserAsync and DeleteUserAsync * Add email templates * Add admin operations for providers * Fix mail template names * Rename roles * Verify provider has provideradmin * Add self hosted check to admin controller * Resolve review comments * Update sql queries * Change create provider to use email instead of userId
This commit is contained in:
45
test/Core.Test/AutoFixture/ProviderUserFixtures.cs
Normal file
45
test/Core.Test/AutoFixture/ProviderUserFixtures.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using System.Reflection;
|
||||
using AutoFixture;
|
||||
using AutoFixture.Xunit2;
|
||||
using Bit.Core.Enums.Provider;
|
||||
|
||||
namespace Bit.Core.Test.AutoFixture.ProviderUserFixtures
|
||||
{
|
||||
internal class ProviderUser : ICustomization
|
||||
{
|
||||
public ProviderUserStatusType Status { get; set; }
|
||||
public ProviderUserType Type { get; set; }
|
||||
|
||||
public ProviderUser(ProviderUserStatusType status, ProviderUserType type)
|
||||
{
|
||||
Status = status;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public void Customize(IFixture fixture)
|
||||
{
|
||||
fixture.Customize<Core.Models.Table.Provider.ProviderUser>(composer => composer
|
||||
.With(o => o.Type, Type)
|
||||
.With(o => o.Status, Status));
|
||||
}
|
||||
}
|
||||
|
||||
public class ProviderUserAttribute : CustomizeAttribute
|
||||
{
|
||||
private readonly ProviderUserStatusType _status;
|
||||
private readonly ProviderUserType _type;
|
||||
|
||||
public ProviderUserAttribute(
|
||||
ProviderUserStatusType status = ProviderUserStatusType.Confirmed,
|
||||
ProviderUserType type = ProviderUserType.ProviderAdmin)
|
||||
{
|
||||
_status = status;
|
||||
_type = type;
|
||||
}
|
||||
|
||||
public override ICustomization GetCustomization(ParameterInfo parameter)
|
||||
{
|
||||
return new ProviderUser(_status, _type);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user