You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/PermissionTestDataBuilder.cs

34 lines
1.1 KiB

using System;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Session;
namespace Volo.Abp.Permissions
{
public class PermissionTestDataBuilder : ITransientDependency
{
public static Guid User1Id { get; } = Guid.NewGuid();
public static Guid User2Id { get; } = Guid.NewGuid();
private readonly IPermissionGrantRepository _permissionGrantRepository;
private readonly IGuidGenerator _guidGenerator;
public PermissionTestDataBuilder(IGuidGenerator guidGenerator, IPermissionGrantRepository permissionGrantRepository)
{
_guidGenerator = guidGenerator;
_permissionGrantRepository = permissionGrantRepository;
}
public void Build()
{
_permissionGrantRepository.Insert(
new PermissionGrant(
_guidGenerator.Create(),
"MyPermission1",
UserPermissionValueProvider.ProviderName,
User1Id.ToString()
)
);
}
}
}