Compare commits

...

8 Commits

Author SHA1 Message Date
Developer 02
59e8c6c0c6 fix(Anwendung): Standard StringLocalizer auf null setzen, um die Abhängigkeit zu entfernen.
- Hochgestuft auf 3.1.2
2025-01-20 14:41:29 +01:00
Developer 02
3cf1215a1c chore(Infrastruktur): Hochgestuft auf 3.0.1 2025-01-20 14:19:37 +01:00
Developer 02
81c00401b7 chore(Domain): Hochgestuft auf 3.0.1 2025-01-20 14:18:26 +01:00
Developer 02
e86b42d955 chore(Application): Hochgerüstet auf 3.1.1 2025-01-20 14:16:08 +01:00
Developer 02
80d28e12b9 refactor: Updated the Application, Domain and Infrastructure projects to support .net 8 in addition to .net 7. 2025-01-20 14:14:24 +01:00
Developer 02
7fc71f427b refactor(Application): made IStringLocalizer<Resource> 2025-01-20 14:10:31 +01:00
Developer 02
bd7d521c1e chore(Application): Hochgestuft auf 3.1 2025-01-15 12:47:11 +01:00
Developer 02
33326866f9 feat(DIExtensions): AddUserManager hinzugefügt, um mit db-Kontext hinzuzufügen 2025-01-15 12:45:59 +01:00
8 changed files with 40 additions and 23 deletions

View File

@@ -44,6 +44,16 @@ namespace DigitalData.UserManager.Application
.AddScoped<IModuleOfUserService, ModuleOfUserService>()
.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)
{
services.AddSingleton<Encryptor>();

View File

@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>UserManager.Application</PackageId>
<Version>3.0.0</Version>
<Version>3.1.2</Version>
<Authors>Digital Data GmbH</Authors>
<Company>Digital Data GmbH</Company>
<Product>UserManager.Application</Product>
@@ -14,6 +14,8 @@
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
<PackageTags>digital data application user maanger</PackageTags>
<AssemblyVersion>3.1.2</AssemblyVersion>
<FileVersion>3.1.2</FileVersion>
</PropertyGroup>
<ItemGroup>
@@ -27,6 +29,7 @@
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="DigitalData.Core.Abstractions" Version="3.1.0" />
<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="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />

View File

@@ -10,8 +10,8 @@ namespace DigitalData.UserManager.Application.Services
{
public class GroupService : BaseService<IGroupRepository, GroupCreateDto, GroupReadDto, Group>, IGroupService
{
private readonly IStringLocalizer<Resource> _localizer;
public GroupService(IGroupRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
private readonly IStringLocalizer<Resource>? _localizer;
public GroupService(IGroupRepository repository, IMapper mapper, IStringLocalizer<Resource>? localizer = null) : base(repository, mapper)
{
_localizer = localizer;
}
@@ -25,7 +25,7 @@ namespace DigitalData.UserManager.Application.Services
group.AddedWho = user?.AddedWho ?? "UNAUTHORIZED";
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);
if (createdGroup is null)

View File

@@ -11,8 +11,8 @@ namespace DigitalData.UserManager.Application.Services
{
public class UserRepService : BaseService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRep>, IUserRepService
{
private readonly IStringLocalizer<Resource> _localizer;
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
private readonly IStringLocalizer<Resource>? _localizer;
public UserRepService(IUserRepRepository repository, IMapper mapper, IStringLocalizer<Resource>? localizer = null) : base(repository, mapper)
{
_localizer = localizer;
}
@@ -27,10 +27,10 @@ namespace DigitalData.UserManager.Application.Services
public override async Task<DataResult<int>> CreateAsync(UserRepCreateDto createDto)
// XOR control
=> (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
: (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);
}
}

View File

@@ -10,8 +10,8 @@ namespace DigitalData.UserManager.Application.Services
{
public class UserService : BaseService<IUserRepository, UserCreateDto, UserReadDto, User>, IUserService
{
private readonly IStringLocalizer<Resource> _localizer;
public UserService(IUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
private readonly IStringLocalizer<Resource>? _localizer;
public UserService(IUserRepository repository, IMapper mapper, IStringLocalizer<Resource>? localizer = null) : base(repository, mapper)
{
_localizer = localizer;
}
@@ -49,7 +49,7 @@ namespace DigitalData.UserManager.Application.Services
var user = _mapper.Map<User>(upDto);
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
var current_user = await GetUserAsync();
@@ -66,7 +66,7 @@ namespace DigitalData.UserManager.Application.Services
{
var user = await _repository.ReadByUsernameAsync(username);
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);
return Result.Success(userDto);

View File

@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>UserManager.Domain</PackageId>
<Version>3.0.0</Version>
<Version>3.0.1</Version>
<Authors>Digital Data GmbH</Authors>
<Company>Digital Data GmbH</Company>
<Product>UserManager.Domain</Product>
@@ -14,6 +14,8 @@
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
<PackageTags>digital data domain user maanger</PackageTags>
<AssemblyVersion>3.0.1</AssemblyVersion>
<FileVersion>3.0.1</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>UserManager.Infrastructure</PackageId>
<Version>3.0.0</Version>
<Version>3.0.1</Version>
<Authors>Digital Data GmbH</Authors>
<Company>Digital Data GmbH</Company>
<Product>UserManager.Infrastructure</Product>
@@ -14,6 +14,8 @@
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
<PackageTags>digital data infrastructure user maanger</PackageTags>
<AssemblyVersion>3.0.1</AssemblyVersion>
<FileVersion>3.0.1</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@@ -17,16 +17,16 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.Build.0 = 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 = 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
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.Build.0 = 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 = 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
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.Build.0 = 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 = 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
{07CCD651-647C-49F7-9715-30CEBC13710D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU