Compare commits
8 Commits
fbf9bbeba0
...
59e8c6c0c6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59e8c6c0c6 | ||
|
|
3cf1215a1c | ||
|
|
81c00401b7 | ||
|
|
e86b42d955 | ||
|
|
80d28e12b9 | ||
|
|
7fc71f427b | ||
|
|
bd7d521c1e | ||
|
|
33326866f9 |
@@ -44,6 +44,16 @@ namespace DigitalData.UserManager.Application
|
|||||||
.AddScoped<IModuleOfUserService, ModuleOfUserService>()
|
.AddScoped<IModuleOfUserService, ModuleOfUserService>()
|
||||||
.AddScoped<IUserRepService, UserRepService>();
|
.AddScoped<IUserRepService, UserRepService>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the UserManager services and repositories to the specified <see cref="IServiceCollection"/>.
|
||||||
|
/// This method registers the necessary mappings, repositories, services and <see cref="UserManagerDbContext"/> for the UserManager.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">The IServiceCollection to which the services will be added.</param>
|
||||||
|
/// <returns>The updated IServiceCollection.</returns>
|
||||||
|
public static IServiceCollection AddUserManager(this IServiceCollection services, string connectionString)=> services
|
||||||
|
.AddDbContext<UserManagerDbContext>(options => options.UseSqlServer(connectionString).EnableSensitiveDataLogging())
|
||||||
|
.AddUserManager<UserManagerDbContext>();
|
||||||
|
|
||||||
public static IServiceCollection AddEncryptor(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddEncryptor(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
services.AddSingleton<Encryptor>();
|
services.AddSingleton<Encryptor>();
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>UserManager.Application</PackageId>
|
<PackageId>UserManager.Application</PackageId>
|
||||||
<Version>3.0.0</Version>
|
<Version>3.1.2</Version>
|
||||||
<Authors>Digital Data GmbH</Authors>
|
<Authors>Digital Data GmbH</Authors>
|
||||||
<Company>Digital Data GmbH</Company>
|
<Company>Digital Data GmbH</Company>
|
||||||
<Product>UserManager.Application</Product>
|
<Product>UserManager.Application</Product>
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
<PackageIcon>icon.png</PackageIcon>
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||||
<PackageTags>digital data application user maanger</PackageTags>
|
<PackageTags>digital data application user maanger</PackageTags>
|
||||||
|
<AssemblyVersion>3.1.2</AssemblyVersion>
|
||||||
|
<FileVersion>3.1.2</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -27,6 +29,7 @@
|
|||||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||||
<PackageReference Include="DigitalData.Core.Abstractions" Version="3.1.0" />
|
<PackageReference Include="DigitalData.Core.Abstractions" Version="3.1.0" />
|
||||||
<PackageReference Include="DigitalData.Core.Application" Version="3.0.1" />
|
<PackageReference Include="DigitalData.Core.Application" Version="3.0.1" />
|
||||||
|
<PackageReference Include="DigitalData.Core.DTO" Version="2.0.1" />
|
||||||
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction" Version="2.0.0" />
|
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
|
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
{
|
{
|
||||||
public class GroupService : BaseService<IGroupRepository, GroupCreateDto, GroupReadDto, Group>, IGroupService
|
public class GroupService : BaseService<IGroupRepository, GroupCreateDto, GroupReadDto, Group>, IGroupService
|
||||||
{
|
{
|
||||||
private readonly IStringLocalizer<Resource> _localizer;
|
private readonly IStringLocalizer<Resource>? _localizer;
|
||||||
public GroupService(IGroupRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
public GroupService(IGroupRepository repository, IMapper mapper, IStringLocalizer<Resource>? localizer = null) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
_localizer = localizer;
|
_localizer = localizer;
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
group.AddedWho = user?.AddedWho ?? "UNAUTHORIZED";
|
group.AddedWho = user?.AddedWho ?? "UNAUTHORIZED";
|
||||||
|
|
||||||
if (await HasEntity(group.Id))
|
if (await HasEntity(group.Id))
|
||||||
return Result.Fail<int>().Message(_localizer[Key.GroupAlreadyExists.ToString()]);
|
return Result.Fail<int>().Message(_localizer?[Key.GroupAlreadyExists].Value);
|
||||||
|
|
||||||
var createdGroup = await _repository.CreateAsync(group);
|
var createdGroup = await _repository.CreateAsync(group);
|
||||||
if (createdGroup is null)
|
if (createdGroup is null)
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
{
|
{
|
||||||
public class UserRepService : BaseService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRep>, IUserRepService
|
public class UserRepService : BaseService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRep>, IUserRepService
|
||||||
{
|
{
|
||||||
private readonly IStringLocalizer<Resource> _localizer;
|
private readonly IStringLocalizer<Resource>? _localizer;
|
||||||
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
public UserRepService(IUserRepRepository repository, IMapper mapper, IStringLocalizer<Resource>? localizer = null) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
_localizer = localizer;
|
_localizer = localizer;
|
||||||
}
|
}
|
||||||
@@ -27,10 +27,10 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
public override async Task<DataResult<int>> CreateAsync(UserRepCreateDto createDto)
|
public override async Task<DataResult<int>> CreateAsync(UserRepCreateDto createDto)
|
||||||
// XOR control
|
// XOR control
|
||||||
=> (createDto.ValidFrom is null && createDto.ValidTo is not null) || (createDto.ValidFrom is not null && createDto.ValidTo is null)
|
=> (createDto.ValidFrom is null && createDto.ValidTo is not null) || (createDto.ValidFrom is not null && createDto.ValidTo is null)
|
||||||
? Result.Fail<int>().Notice(LogLevel.None, Flag.DataIntegrityIssue, _localizer[Key.DateRangeNotXNOR])
|
? Result.Fail<int>().Notice(LogLevel.None, Flag.DataIntegrityIssue, _localizer?[Key.DateRangeNotXNOR].Value)
|
||||||
//date range control
|
//date range control
|
||||||
: (createDto.ValidFrom > createDto.ValidTo)
|
: (createDto.ValidFrom > createDto.ValidTo)
|
||||||
? Result.Fail<int>().Notice(LogLevel.None, Flag.DataIntegrityIssue, _localizer[Key.InvalidDateRange])
|
? Result.Fail<int>().Notice(LogLevel.None, Flag.DataIntegrityIssue, _localizer?[Key.InvalidDateRange].Value)
|
||||||
: await base.CreateAsync(createDto);
|
: await base.CreateAsync(createDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,8 +10,8 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
{
|
{
|
||||||
public class UserService : BaseService<IUserRepository, UserCreateDto, UserReadDto, User>, IUserService
|
public class UserService : BaseService<IUserRepository, UserCreateDto, UserReadDto, User>, IUserService
|
||||||
{
|
{
|
||||||
private readonly IStringLocalizer<Resource> _localizer;
|
private readonly IStringLocalizer<Resource>? _localizer;
|
||||||
public UserService(IUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
public UserService(IUserRepository repository, IMapper mapper, IStringLocalizer<Resource>? localizer = null) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
_localizer = localizer;
|
_localizer = localizer;
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
var user = _mapper.Map<User>(upDto);
|
var user = _mapper.Map<User>(upDto);
|
||||||
|
|
||||||
if (await HasEntity(user.Id))
|
if (await HasEntity(user.Id))
|
||||||
return Result.Fail<int>().Message(_localizer[Key.UserAlreadyExists]);
|
return Result.Fail<int>().Message(_localizer?[Key.UserAlreadyExists].Value);
|
||||||
|
|
||||||
//set the user
|
//set the user
|
||||||
var current_user = await GetUserAsync();
|
var current_user = await GetUserAsync();
|
||||||
@@ -66,7 +66,7 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
{
|
{
|
||||||
var user = await _repository.ReadByUsernameAsync(username);
|
var user = await _repository.ReadByUsernameAsync(username);
|
||||||
if (user is null)
|
if (user is null)
|
||||||
return Result.Fail<UserReadDto>().Message(_localizer[Key.UserNotFoundInLocalDB]);
|
return Result.Fail<UserReadDto>().Message(_localizer?[Key.UserNotFoundInLocalDB].Value);
|
||||||
|
|
||||||
var userDto = _mapper.Map<UserReadDto>(user);
|
var userDto = _mapper.Map<UserReadDto>(user);
|
||||||
return Result.Success(userDto);
|
return Result.Success(userDto);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>UserManager.Domain</PackageId>
|
<PackageId>UserManager.Domain</PackageId>
|
||||||
<Version>3.0.0</Version>
|
<Version>3.0.1</Version>
|
||||||
<Authors>Digital Data GmbH</Authors>
|
<Authors>Digital Data GmbH</Authors>
|
||||||
<Company>Digital Data GmbH</Company>
|
<Company>Digital Data GmbH</Company>
|
||||||
<Product>UserManager.Domain</Product>
|
<Product>UserManager.Domain</Product>
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
<PackageIcon>icon.png</PackageIcon>
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||||
<PackageTags>digital data domain user maanger</PackageTags>
|
<PackageTags>digital data domain user maanger</PackageTags>
|
||||||
|
<AssemblyVersion>3.0.1</AssemblyVersion>
|
||||||
|
<FileVersion>3.0.1</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>UserManager.Infrastructure</PackageId>
|
<PackageId>UserManager.Infrastructure</PackageId>
|
||||||
<Version>3.0.0</Version>
|
<Version>3.0.1</Version>
|
||||||
<Authors>Digital Data GmbH</Authors>
|
<Authors>Digital Data GmbH</Authors>
|
||||||
<Company>Digital Data GmbH</Company>
|
<Company>Digital Data GmbH</Company>
|
||||||
<Product>UserManager.Infrastructure</Product>
|
<Product>UserManager.Infrastructure</Product>
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
<PackageIcon>icon.png</PackageIcon>
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||||
<PackageTags>digital data infrastructure user maanger</PackageTags>
|
<PackageTags>digital data infrastructure user maanger</PackageTags>
|
||||||
|
<AssemblyVersion>3.0.1</AssemblyVersion>
|
||||||
|
<FileVersion>3.0.1</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -17,16 +17,16 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||||
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Release|Any CPU.Build.0 = Release|Any CPU
|
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||||
{1DD81373-82F9-4872-95C6-888624DB1797}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1DD81373-82F9-4872-95C6-888624DB1797}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1DD81373-82F9-4872-95C6-888624DB1797}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1DD81373-82F9-4872-95C6-888624DB1797}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{07CCD651-647C-49F7-9715-30CEBC13710D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{07CCD651-647C-49F7-9715-30CEBC13710D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
|||||||
Reference in New Issue
Block a user