mirror of
https://github.com/hmaxnl/DotBased.git
synced 2025-01-18 10:04:20 +01:00
[CHANGE] Repository manager
This commit is contained in:
parent
172d5838e7
commit
2d96a25906
|
@ -2,6 +2,6 @@ namespace DotBased.AspNet.Authority.Repositories;
|
|||
|
||||
public interface IAuthorityRepository
|
||||
{
|
||||
public Task<int> GetVersion();
|
||||
public Task SetVersion(int version);
|
||||
public Task<long> GetVersion();
|
||||
public Task SetVersion(long version);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
namespace DotBased.AspNet.Authority.Repositories;
|
||||
|
||||
public interface IGroupRepository<TGroup, TId> where TGroup : class where TId : IEquatable<TId>
|
||||
public interface IGroupRepository<TGroup> where TGroup : class
|
||||
{
|
||||
|
||||
}
|
13
DotBased.AspNet.Authority/Repositories/RepositoryManager.cs
Normal file
13
DotBased.AspNet.Authority/Repositories/RepositoryManager.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace DotBased.AspNet.Authority.Repositories;
|
||||
|
||||
public class RepositoryManager<TUser, TGroup> where TUser : class where TGroup : class
|
||||
{
|
||||
public RepositoryManager(IUserRepository<TUser> userRepository, IGroupRepository<TGroup> groupRepository)
|
||||
{
|
||||
UserRepository = userRepository;
|
||||
GroupRepository = groupRepository;
|
||||
}
|
||||
|
||||
public IUserRepository<TUser> UserRepository { get; set; }
|
||||
public IGroupRepository<TGroup> GroupRepository { get; set; }
|
||||
}
|
|
@ -83,11 +83,11 @@ public class AuthorityManager
|
|||
_logger.Debug("{HandledPropCount}/{TotalPropCount} protection properties handled!", handledProperties, props.Count);
|
||||
}
|
||||
|
||||
public bool IsPropertieProtected<TModel>(string propertieName)
|
||||
public bool IsPropertyProtected<TModel>(string propertyName)
|
||||
{
|
||||
var protectedProperties = GetProtectedProperties<TModel>();
|
||||
var propertieFound = protectedProperties.Where(propInfo => propInfo.Name == propertieName);
|
||||
return propertieFound.Any();
|
||||
var propertyFound = protectedProperties.Where(propInfo => propInfo.Name == propertyName);
|
||||
return propertyFound.Any();
|
||||
}
|
||||
|
||||
public List<PropertyInfo> GetProtectedPropertiesValues<TModel>(TModel model)
|
||||
|
|
Loading…
Reference in New Issue
Block a user