Refaktorisierung der Lokalisierung und DTO-Integration
- Ersetzung von ITranslateService durch IStringLocalizer<X> für verbesserte Lokalisierung. - Aktualisierung der DTO-Klassen entsprechend der neuesten Core.DTO-Struktur. - Integration der neuen Klassen Result und DataResult aus Core.DTO für standardisierte Serviceantworten.
This commit is contained in:
parent
dbe3743660
commit
0abdbfa705
@ -9,6 +9,8 @@ using DigitalData.UserManager.Application;
|
||||
using DigitalData.UserManager.Application.DTOs.Auth;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.API.Controllers
|
||||
{
|
||||
@ -20,14 +22,16 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
private IMemoryCache _memoryCache;
|
||||
private IConfiguration _configuration;
|
||||
private IDirectorySearchService _dirSearchService;
|
||||
private readonly IStringLocalizer<Resource> _localizer;
|
||||
|
||||
public AuthController(IUserService userService, IGroupOfUserService gouService, IMemoryCache memoryCache, IConfiguration configuration, IDirectorySearchService directorySearchService)
|
||||
public AuthController(IUserService userService, IGroupOfUserService gouService, IMemoryCache memoryCache, IConfiguration configuration, IDirectorySearchService directorySearchService, IStringLocalizer<Resource> localizer)
|
||||
{
|
||||
_userService = userService;
|
||||
_gouService = gouService;
|
||||
_memoryCache = memoryCache;
|
||||
_configuration = configuration;
|
||||
_dirSearchService = directorySearchService;
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
@ -41,11 +45,11 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
bool isValid = _dirSearchService.ValidateCredentials(login.Username, login.Password);
|
||||
|
||||
if (!isValid)
|
||||
return Unauthorized(_userService.Failed(MessageKey.UserNotFound.ToString()));
|
||||
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound]));
|
||||
|
||||
var gouMsg = await _gouService.HasGroup(login.Username, "PM_USER", caseSensitive:false);
|
||||
if(!gouMsg.IsSuccess)
|
||||
return Unauthorized(_userService.Failed(MessageKey.UnauthorizedUser.ToString()));
|
||||
return Unauthorized(Result.Fail().Message(_localizer[Key.UnauthorizedUser]));
|
||||
|
||||
//find the user
|
||||
var uRes = await _userService.ReadByUsernameAsync(login.Username);
|
||||
@ -103,7 +107,7 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
|
||||
if (!userDto.IsSuccess || userDto.Data is null)
|
||||
{
|
||||
return NotFound(_userService.Failed("User not found."));
|
||||
return NotFound(Result.Fail().Message(_localizer[Key.UserNotFound]));
|
||||
}
|
||||
|
||||
return Ok(userDto.Data);
|
||||
|
||||
@ -6,11 +6,8 @@ using Microsoft.Extensions.Caching.Memory;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Security.Claims;
|
||||
using DigitalData.UserManager.Application;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using System.DirectoryServices;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.API.Controllers
|
||||
{
|
||||
@ -23,10 +20,12 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
private IDirectorySearchService _dirSearchService;
|
||||
private IMemoryCache _memoryCache;
|
||||
private Dictionary<string, string> _customSearchFilters;
|
||||
private readonly IStringLocalizer<Resource> _localizer;
|
||||
|
||||
public DirectoryController(IConfiguration configuration, ILogger<DirectoryController> logger, IUserService userService, IDirectorySearchService directorySearchService, IMemoryCache memoryCache)
|
||||
public DirectoryController(IConfiguration configuration, ILogger<DirectoryController> logger, IStringLocalizer<Resource> localizer, IUserService userService, IDirectorySearchService directorySearchService, IMemoryCache memoryCache)
|
||||
{
|
||||
_logger = logger;
|
||||
_localizer = localizer;
|
||||
_userService = userService;
|
||||
_dirSearchService = directorySearchService;
|
||||
_memoryCache = memoryCache;
|
||||
@ -76,11 +75,11 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
bool isValid = _dirSearchService.ValidateCredentials(dirEntryUsername, searchRootCreateDto.DirEntryPassword);
|
||||
|
||||
if (!isValid)
|
||||
return Unauthorized(_dirSearchService.Failed(MessageKey.UserNotFound.ToString()));
|
||||
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound]));
|
||||
|
||||
var userResult = await _userService.ReadByUsernameAsync(dirEntryUsername);
|
||||
if(!userResult.IsSuccess || userResult.Data is null)
|
||||
return Unauthorized(_dirSearchService.Failed(MessageKey.UserNotFoundInLocalDB.ToString()));
|
||||
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFoundInLocalDB]));
|
||||
|
||||
_dirSearchService.SetSearchRootCache(userResult.Data.Username, searchRootCreateDto.DirEntryPassword);
|
||||
return Ok();
|
||||
|
||||
@ -19,7 +19,7 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
[HttpDelete]
|
||||
public async Task<IActionResult> Delete([FromQuery] int moduleId, [FromQuery]int userId)
|
||||
{
|
||||
IServiceMessage result = await _service.DeleteAsyncByModuleUserId(moduleId, userId);
|
||||
var result = await _service.DeleteAsyncByModuleUserId(moduleId, userId);
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
return Ok(result);
|
||||
|
||||
@ -6,14 +6,6 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="nlog.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="nlog.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.14" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
|
||||
@ -47,8 +39,8 @@
|
||||
<Reference Include="DigitalData.Core.Contracts">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Contracts\bin\Debug\net7.0\DigitalData.Core.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Core.CultureServices">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.CultureServices\bin\Debug\net7.0\DigitalData.Core.CultureServices.dll</HintPath>
|
||||
<Reference Include="DigitalData.Core.DTO">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.API\bin\Debug\net7.0\DigitalData.Core.DTO.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Core.Infrastructure">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Infrastructure\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll</HintPath>
|
||||
|
||||
@ -4,7 +4,6 @@ using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.Services;
|
||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.Core.CultureServices;
|
||||
using DigitalData.Core.Application;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using NLog.Web;
|
||||
@ -35,14 +34,13 @@ try {
|
||||
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||
.AddCookie(options =>
|
||||
{
|
||||
options.Cookie.HttpOnly = false;
|
||||
//options.Cookie.SecurePolicy = CookieSecurePolicy.Always; //always https
|
||||
options.Cookie.SameSite = SameSiteMode.None;
|
||||
options.Cookie.HttpOnly = true; // Makes the cookie inaccessible to client-side scripts for security
|
||||
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest; // Ensures cookies are sent over HTTPS only
|
||||
options.Cookie.SameSite = SameSiteMode.Strict; // Protects against CSRF attacks by restricting how cookies are sent with requests from external sites
|
||||
options.LoginPath = "/api/auth/login";
|
||||
options.LogoutPath = "/api/auth/logout";
|
||||
});
|
||||
|
||||
|
||||
builder.Services.AddDbContext<DDECMDbContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("DD_ECM_Connection"))
|
||||
.EnableDetailedErrors());
|
||||
@ -61,15 +59,13 @@ try {
|
||||
});
|
||||
});
|
||||
|
||||
builder.Services.AddKeyTranslationService();
|
||||
|
||||
builder.Services.AddAutoMapper(typeof(UserMappingProfile).Assembly);
|
||||
builder.Services.AddAutoMapper(typeof(GroupMappingProfile).Assembly);
|
||||
builder.Services.AddAutoMapper(typeof(GroupOfUserMappingProfile).Assembly);
|
||||
builder.Services.AddAutoMapper(typeof(ModuleMappingProfile).Assembly);
|
||||
builder.Services.AddAutoMapper(typeof(ModuleOfUserMappingProfile).Assembly);
|
||||
builder.Services.AddAutoMapper(typeof(UserRepMappingProfile).Assembly);
|
||||
builder.Services.AddAutoMapper(typeof(DirectoryMappingProfile).Assembly);
|
||||
//builder.Services.AddAutoMapper(typeof(DirectoryMappingProfile).Assembly);
|
||||
|
||||
builder.Services.AddScoped<IUserRepository, UserRepository>();
|
||||
builder.Services.AddScoped<IGroupRepository, GroupRepository>();
|
||||
@ -86,7 +82,6 @@ try {
|
||||
builder.Services.AddScoped<IUserRepService, UserRepService>();
|
||||
|
||||
builder.Services.AddDirectorySearchService();
|
||||
builder.Services.AddResponseService();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -30,7 +30,7 @@
|
||||
"targets": {
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log"
|
||||
"fileName": "E:/WebUserManager/logs/${shortdate}.log"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "Console"
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<targets>
|
||||
<target xsi:type="File" name="dailyfile"
|
||||
fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<logger name="*" minlevel="Debug" writeTo="dailyfile" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@ -275,7 +275,6 @@ E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.API.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.Application.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.Contracts.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.CultureServices.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.UserManager.Application.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.UserManager.Domain.dll
|
||||
@ -286,7 +285,6 @@ E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.API.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.Application.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.Contracts.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.CultureServices.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.Infrastructure.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\DigitalData.UserManager.API.csproj.AssemblyReference.cache
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\DigitalData.UserManager.API.GeneratedMSBuildEditorConfig.editorconfig
|
||||
@ -303,9 +301,12 @@ E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\staticwebassets.build.json
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\staticwebassets.development.json
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\scopedcss\bundle\DigitalData.UserManager.API.styles.css
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\DigitalData.UserManager.API.csproj.CopyComplete
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\DigitalData.UserManager.API.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\refint\DigitalData.UserManager.API.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\DigitalData.UserManager.API.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\DigitalData.UserManager.API.genruntimeconfig.cache
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\ref\DigitalData.UserManager.API.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\Microsoft.Extensions.Localization.Abstractions.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.DTO.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\bin\Debug\net7.0\DigitalData.Core.DTO.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\obj\Debug\net7.0\DigitalD.2ACBF1F0.Up2Date
|
||||
|
||||
@ -1 +1 @@
|
||||
5243960bb1a8dfa8a26e6ced911ddcfcfbd49603
|
||||
5db32c07a921a075542f8e4d13a06dff0a7877311019b550d9af1d527121948b
|
||||
|
||||
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"Hash": "CVuGk5G2Z4tefLO3i5UULN9tcqrmHVfR7Mp+pLcIhcg=",
|
||||
"Hash": "fpX0gIRTqJ92FKdK8Mopb4TdlAI0zjfIY8Z63x82Wg4=",
|
||||
"Source": "DigitalData.UserManager.API",
|
||||
"BasePath": "_content/DigitalData.UserManager.API",
|
||||
"Mode": "Default",
|
||||
@ -26,6 +26,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -43,6 +45,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -60,6 +64,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -77,6 +83,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -94,6 +102,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -111,6 +121,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -128,6 +140,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -145,6 +159,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -162,6 +178,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -179,6 +197,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -196,6 +216,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -213,6 +235,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -230,6 +254,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -247,6 +273,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -264,6 +292,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -281,6 +311,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
@ -298,6 +330,8 @@
|
||||
"AssetKind": "All",
|
||||
"AssetMode": "All",
|
||||
"AssetRole": "Primary",
|
||||
"AssetMergeBehavior": "PreferTarget",
|
||||
"AssetMergeSource": "",
|
||||
"RelatedAsset": "",
|
||||
"AssetTraitName": "",
|
||||
"AssetTraitValue": "",
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<meta charset="utf-8"/>
|
||||
<title>User Manager Portal</title>
|
||||
<base href="/"/>
|
||||
<user-manager-api href="https://172.24.12.39/api/" user-route="user" group-route="group" module-route="module" module-of-user-route="moduleOfUser" group-of-user-route="groupOfUser" user-representation-route="userRep" dir-group-route="directory/Group?propName=samaccountname" dir-user-route="directory/user" dir-route="directory" login-route="auth/login" ,="" logout-route="auth/logout" login-check-route="auth/check"/>
|
||||
<user-manager-api href="/api/" user-route="user" group-route="group" module-route="module" module-of-user-route="moduleOfUser" group-of-user-route="groupOfUser" user-representation-route="userRep" dir-group-route="directory/Group?propName=samaccountname" dir-user-route="directory/user" dir-route="directory" login-route="auth/login" ,="" logout-route="auth/logout" login-check-route="auth/check"/>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico"/>
|
||||
|
||||
@ -2,15 +2,16 @@
|
||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IGroupOfUserService : ICRUDService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser, int>
|
||||
{
|
||||
Task<IServiceMessage> DeleteAsyncByGroupUserId(int groupId, int userId);
|
||||
Task<Result> DeleteAsyncByGroupUserId(int groupId, int userId);
|
||||
|
||||
Task<IServiceResult<IEnumerable<GroupOfUserReadDto>>> ReadAllAsyncWith(bool user, bool group);
|
||||
Task<DataResult<IEnumerable<GroupOfUserReadDto>>> ReadAllAsyncWith(bool user, bool group);
|
||||
|
||||
Task<IServiceMessage> HasGroup(string username, string groupname, bool caseSensitive = true);
|
||||
Task<Result> HasGroup(string username, string groupname, bool caseSensitive = true);
|
||||
}
|
||||
}
|
||||
@ -2,11 +2,12 @@
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IGroupService : ICRUDService<IGroupRepository, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int>
|
||||
{
|
||||
Task<IServiceResult<int>> CreateAsync(DirectoryGroupDto dirGroup);
|
||||
Task<DataResult<int>> CreateAsync(DirectoryGroupDto dirGroup);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
@ -7,6 +8,6 @@ namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IModuleOfUserService : ICRUDService<IModuleOfUserRepository, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>
|
||||
{
|
||||
Task<IServiceMessage> DeleteAsyncByModuleUserId(int moduleId, int userId);
|
||||
Task<Result> DeleteAsyncByModuleUserId(int moduleId, int userId);
|
||||
}
|
||||
}
|
||||
@ -2,11 +2,12 @@
|
||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IUserRepService : ICRUDService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>
|
||||
{
|
||||
Task<IServiceResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null);
|
||||
Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null);
|
||||
}
|
||||
}
|
||||
@ -2,21 +2,22 @@
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.Core.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
public interface IUserService : ICRUDService<IUserRepository, UserCreateDto, UserReadDto, UserUpdateDto, User, int>
|
||||
{
|
||||
Task<IServiceResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId);
|
||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId);
|
||||
|
||||
Task<IServiceResult<IEnumerable<UserReadDto>>> ReadUnassignedByModuleIdAsync(int moduleId);
|
||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadUnassignedByModuleIdAsync(int moduleId);
|
||||
|
||||
Task<IServiceResult<IEnumerable<UserReadDto>>> ReadByGroupIdAsync(int groupId);
|
||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadByGroupIdAsync(int groupId);
|
||||
|
||||
Task<IServiceResult<IEnumerable<UserReadDto>>> ReadUnassignedByGroupIdAsync(int groupId);
|
||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadUnassignedByGroupIdAsync(int groupId);
|
||||
|
||||
Task<IServiceResult<int>> CreateAsync(UserPrincipalDto upDto);
|
||||
Task<DataResult<int>> CreateAsync(UserPrincipalDto upDto);
|
||||
|
||||
Task<IServiceResult<UserReadDto>> ReadByUsernameAsync(string username);
|
||||
Task<DataResult<UserReadDto>> ReadByUsernameAsync(string username);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
@ -8,8 +8,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
|
||||
<PackageReference Include="System.DirectoryServices" Version="7.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices.Protocols" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -24,6 +26,9 @@
|
||||
<Reference Include="DigitalData.Core.Contracts">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Core.DTO">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.DTO.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
12
DigitalData.UserManager.Application/Key.cs
Normal file
12
DigitalData.UserManager.Application/Key.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace DigitalData.UserManager.Application
|
||||
{
|
||||
public static class Key
|
||||
{
|
||||
public static readonly string UserNotFoundInLocalDB = "UserNotFoundInLocalDB";
|
||||
public static readonly string GroupNotFound = "GroupNotFound";
|
||||
public static readonly string GroupAlreadyExists = "GroupAlreadyExists";
|
||||
public static readonly string UserAlreadyExists = "UserAlreadyExists";
|
||||
public static readonly string UserNotFound = "UserNotFound";
|
||||
public static readonly string UnauthorizedUser = "UnauthorizedUser";
|
||||
}
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
namespace DigitalData.UserManager.Application
|
||||
{
|
||||
public enum MessageKey
|
||||
{
|
||||
UserNotFoundInLocalDB,
|
||||
GroupNotFound,
|
||||
GroupAlreadyExists,
|
||||
UserAlreadyExists,
|
||||
UserNotFound,
|
||||
UnauthorizedUser
|
||||
}
|
||||
}
|
||||
9
DigitalData.UserManager.Application/Resource.cs
Normal file
9
DigitalData.UserManager.Application/Resource.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace DigitalData.UserManager.Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Place holder class for Resource.*.resx as the resouce of IStringLocalizer.
|
||||
/// </summary>
|
||||
public class Resource
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,21 +1,21 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class GroupOfUserService : CRUDService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser, int>, IGroupOfUserService
|
||||
{
|
||||
public GroupOfUserService(IGroupOfUserRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public GroupOfUserService(IGroupOfUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceMessage> DeleteAsyncByGroupUserId(int groupId, int userId)
|
||||
public async Task<Result> DeleteAsyncByGroupUserId(int groupId, int userId)
|
||||
{
|
||||
var mous = await _repository.ReadByGroupUserIdAsync(groupId, userId);
|
||||
|
||||
@ -24,10 +24,10 @@ namespace DigitalData.UserManager.Application.Services
|
||||
await _repository.DeleteAsync(mou);
|
||||
}
|
||||
|
||||
return Successful();
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<GroupOfUserReadDto>>> ReadAllAsyncWith(bool user, bool group)
|
||||
public async Task<DataResult<IEnumerable<GroupOfUserReadDto>>> ReadAllAsyncWith(bool user, bool group)
|
||||
{
|
||||
IEnumerable<GroupOfUser> entities;
|
||||
|
||||
@ -49,10 +49,10 @@ namespace DigitalData.UserManager.Application.Services
|
||||
}
|
||||
|
||||
var gouReadDtos = _mapper.MapOrThrow<IEnumerable<GroupOfUserReadDto>>(entities);
|
||||
return Successful(gouReadDtos);
|
||||
return Result.Success(gouReadDtos);
|
||||
}
|
||||
|
||||
public async Task<IServiceMessage> HasGroup(string username, string groupname, bool caseSensitive = true)
|
||||
public async Task<Result> HasGroup(string username, string groupname, bool caseSensitive = true)
|
||||
{
|
||||
var gous = await _repository.ReadAllAsyncWithGroupAndUser();
|
||||
|
||||
@ -61,7 +61,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
else
|
||||
gous = gous.Where(gous => gous.User?.Username.ToLower() == username.ToLower() && gous.Group?.Name?.ToLower() == groupname.ToLower());
|
||||
|
||||
return CreateMessage(gous.Any());
|
||||
return gous.Any() ? Result.Success() : Result.Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,32 +1,32 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class GroupService : CRUDService<IGroupRepository, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int>, IGroupService
|
||||
{
|
||||
public GroupService(IGroupRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public GroupService(IGroupRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<int>> CreateAsync(DirectoryGroupDto adGroup)
|
||||
public async Task<DataResult<int>> CreateAsync(DirectoryGroupDto adGroup)
|
||||
{
|
||||
var group = _mapper.MapOrThrow<Group>(adGroup);
|
||||
|
||||
if (await HasEntity(group.Guid))
|
||||
return Failed<int>(MessageKey.GroupAlreadyExists.ToString());
|
||||
return Result.Fail<int>().Message(_localizer[Key.GroupAlreadyExists.ToString()]);
|
||||
|
||||
var createdGroup = await _repository.CreateAsync(group);
|
||||
if (createdGroup is null)
|
||||
return Failed<int>();
|
||||
return Result.Fail<int>();
|
||||
else
|
||||
return Successful(KeyValueOf(createdGroup));
|
||||
return Result.Success(KeyValueOf(createdGroup));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,21 +1,21 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class ModuleOfUserService : CRUDService<IModuleOfUserRepository, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>, IModuleOfUserService
|
||||
{
|
||||
public ModuleOfUserService(IModuleOfUserRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public ModuleOfUserService(IModuleOfUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceMessage> DeleteAsyncByModuleUserId(int moduleId, int userId)
|
||||
public async Task<Result> DeleteAsyncByModuleUserId(int moduleId, int userId)
|
||||
{
|
||||
var mous = await _repository.ReadByModelUserIdAsync(moduleId, userId);
|
||||
|
||||
@ -24,7 +24,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
await _repository.DeleteAsync(mou);
|
||||
}
|
||||
|
||||
return Successful();
|
||||
return Result.Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,16 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.Module;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class ModuleService : BasicCRUDService<IModuleRepository, ModuleDto, Module, int>, IModuleService
|
||||
{
|
||||
public ModuleService(IModuleRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public ModuleService(IModuleRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class UserRepService : CRUDService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>, IUserRepService
|
||||
{
|
||||
public UserRepService(IUserRepRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null)
|
||||
public async Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null)
|
||||
{
|
||||
var urs = await _repository.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId);
|
||||
var urReadDTOs = _mapper.MapOrThrow<IEnumerable<UserRepReadDto>>(urs);
|
||||
return Successful(urReadDTOs);
|
||||
return Result.Success(urReadDTOs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,70 +1,70 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class UserService : CRUDService<IUserRepository, UserCreateDto, UserReadDto, UserUpdateDto, User, int>, IUserService
|
||||
{
|
||||
public UserService(IUserRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
public UserService(IUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId)
|
||||
public async Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId)
|
||||
{
|
||||
var users = await _repository.ReadByModuleIdAsync(moduleId);
|
||||
IEnumerable<UserReadDto> readDTOs = _mapper.MapOrThrow<IEnumerable<UserReadDto>>(users);
|
||||
return Successful(readDTOs);
|
||||
return Result.Success(readDTOs);
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserReadDto>>> ReadByGroupIdAsync(int groupId)
|
||||
public async Task<DataResult<IEnumerable<UserReadDto>>> ReadByGroupIdAsync(int groupId)
|
||||
{
|
||||
var users = await _repository.ReadByGroupIdAsync(groupId);
|
||||
IEnumerable<UserReadDto> readDTOs = _mapper.MapOrThrow<IEnumerable<UserReadDto>>(users);
|
||||
return Successful(readDTOs);
|
||||
return Result.Success(readDTOs);
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserReadDto>>> ReadUnassignedByModuleIdAsync(int moduleId)
|
||||
public async Task<DataResult<IEnumerable<UserReadDto>>> ReadUnassignedByModuleIdAsync(int moduleId)
|
||||
{
|
||||
var users = await _repository.ReadUnassignedByModuleIdAsync(moduleId);
|
||||
IEnumerable<UserReadDto> readDTOs = _mapper.MapOrThrow<IEnumerable<UserReadDto>>(users);
|
||||
return Successful(readDTOs);
|
||||
return Result.Success(readDTOs);
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<IEnumerable<UserReadDto>>> ReadUnassignedByGroupIdAsync(int groupId)
|
||||
public async Task<DataResult<IEnumerable<UserReadDto>>> ReadUnassignedByGroupIdAsync(int groupId)
|
||||
{
|
||||
var users = await _repository.ReadUnassignedByGroupIdAsync(groupId);
|
||||
IEnumerable<UserReadDto> readDTOs = _mapper.MapOrThrow<IEnumerable<UserReadDto>>(users);
|
||||
return Successful(readDTOs);
|
||||
return Result.Success(readDTOs);
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<int>> CreateAsync(UserPrincipalDto upDto)
|
||||
public async Task<DataResult<int>> CreateAsync(UserPrincipalDto upDto)
|
||||
{
|
||||
var user = _mapper.MapOrThrow<User>(upDto);
|
||||
|
||||
if (await HasEntity(user.Guid))
|
||||
return Failed<int>(MessageKey.UserAlreadyExists.ToString());
|
||||
return Result.Fail<int>().Message(_localizer[Key.UserAlreadyExists]);
|
||||
|
||||
var createdUser = await _repository.CreateAsync(user);
|
||||
if (createdUser is null)
|
||||
return Failed<int>();
|
||||
return Result.Fail<int>();
|
||||
else
|
||||
return Successful(KeyValueOf(createdUser));
|
||||
return Result.Success(KeyValueOf(createdUser));
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<UserReadDto>> ReadByUsernameAsync(string username)
|
||||
public async Task<DataResult<UserReadDto>> ReadByUsernameAsync(string username)
|
||||
{
|
||||
var user = await _repository.ReadByUsernameAsync(username);
|
||||
if (user is null)
|
||||
return Failed<UserReadDto>(MessageKey.UserNotFoundInLocalDB.ToString());
|
||||
return Result.Fail<UserReadDto>().Message(_localizer[Key.UserNotFoundInLocalDB]);
|
||||
|
||||
var userDto = _mapper.MapOrThrow<UserReadDto>(user);
|
||||
return Successful(userDto);
|
||||
return Result.Success(userDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@ -64,8 +64,10 @@ E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Deb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.AssemblyInfoInputs.cache
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.AssemblyInfo.cs
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.csproj.CoreCompileInputs.cache
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.csproj.CopyComplete
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\refint\DigitalData.UserManager.Application.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalData.UserManager.Application.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\ref\DigitalData.UserManager.Application.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\bin\Debug\net7.0\DigitalData.Core.DTO.dll
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\bin\Debug\net7.0\DigitalData.Core.DTO.pdb
|
||||
E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\obj\Debug\net7.0\DigitalD.78E1DF98.Up2Date
|
||||
|
||||
7
DigitalData.UserManager.DTO/Class1.cs
Normal file
7
DigitalData.UserManager.DTO/Class1.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace DigitalData.UserManager.DTO
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
4
DigitalData.UserManager.DTO/DTOs/Auth/AuthCheckDto.cs
Normal file
4
DigitalData.UserManager.DTO/DTOs/Auth/AuthCheckDto.cs
Normal file
@ -0,0 +1,4 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.Auth
|
||||
{
|
||||
public record AuthCheckDto (bool IsAuthenticated);
|
||||
}
|
||||
4
DigitalData.UserManager.DTO/DTOs/Auth/LogInDto.cs
Normal file
4
DigitalData.UserManager.DTO/DTOs/Auth/LogInDto.cs
Normal file
@ -0,0 +1,4 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.Auth
|
||||
{
|
||||
public record LogInDto(string Username, string Password);
|
||||
}
|
||||
28
DigitalData.UserManager.DTO/DTOs/Group/DirectoryGroupDto.cs
Normal file
28
DigitalData.UserManager.DTO/DTOs/Group/DirectoryGroupDto.cs
Normal file
@ -0,0 +1,28 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.Group
|
||||
{
|
||||
public record DirectoryGroupDto
|
||||
(
|
||||
IEnumerable<string> Samaccountname
|
||||
//public string Name { get; set; }
|
||||
//public string ObjectSid { get; set; }
|
||||
//public string ObjectCategory { get; set; }
|
||||
//public int SamAccountType { get; set; }
|
||||
//public string DistinguishedName { get; set; }
|
||||
//public int InstanceType { get; set; }
|
||||
//public string CN { get; set; }
|
||||
//public string ObjectClass { get; set; }
|
||||
//public DateTime WhenChanged { get; set; }
|
||||
//public Guid ObjectGuid { get; set; }
|
||||
//public long UsnCreated { get; set; }
|
||||
//public int? GroupType { get; set; }
|
||||
//public DateTime? DsCorePropagationData { get; set; }
|
||||
//public int? AdminCount { get; set; }
|
||||
//public int? SystemFlags { get; set; }
|
||||
//public string Member { get; set; }
|
||||
//public string AdsPath { get; set; }
|
||||
//public long UsnChanged { get; set; }
|
||||
//public DateTime WhenCreated { get; set; }
|
||||
//public string Description { get; set; }
|
||||
//public bool? IsCriticalSystemObject { get; set; }
|
||||
);
|
||||
}
|
||||
13
DigitalData.UserManager.DTO/DTOs/Group/GroupCreateDto.cs
Normal file
13
DigitalData.UserManager.DTO/DTOs/Group/GroupCreateDto.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.Group
|
||||
{
|
||||
public record GroupCreateDto
|
||||
(
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
bool? Active,
|
||||
string? Comment,
|
||||
string? AddedWho,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
14
DigitalData.UserManager.DTO/DTOs/Group/GroupReadDto.cs
Normal file
14
DigitalData.UserManager.DTO/DTOs/Group/GroupReadDto.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.Group
|
||||
{
|
||||
public record GroupReadDto
|
||||
(
|
||||
int Guid,
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
bool? Active,
|
||||
string? Comment,
|
||||
string? AddedWho,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
13
DigitalData.UserManager.DTO/DTOs/Group/GroupUpdateDto.cs
Normal file
13
DigitalData.UserManager.DTO/DTOs/Group/GroupUpdateDto.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.Group
|
||||
{
|
||||
public record GroupUpdateDto
|
||||
(
|
||||
int Guid,
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
bool? Active,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserCreateDto(
|
||||
int UserId,
|
||||
int GroupId,
|
||||
string? Comment,
|
||||
string? AddedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
|
||||
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserReadDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int GroupId,
|
||||
string? Comment,
|
||||
string AddedWho,
|
||||
string? ChangedWho,
|
||||
UserReadDto User,
|
||||
GroupReadDto Group
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserUpdateDto(
|
||||
int Guid,
|
||||
int? UserId,
|
||||
int? GroupId,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
8
DigitalData.UserManager.DTO/DTOs/Module/ModuleDto.cs
Normal file
8
DigitalData.UserManager.DTO/DTOs/Module/ModuleDto.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.Module
|
||||
{
|
||||
public record ModuleDto(
|
||||
int Guid,
|
||||
string? Name,
|
||||
string? ShortName
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserCreateDto(
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
bool IsAdmin,
|
||||
string? Comment,
|
||||
string? AddedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserReadDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
string? Comment,
|
||||
string? AddedWho,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserUpdateDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
bool? IsAdmin,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
4
DigitalData.UserManager.DTO/DTOs/SearchRootCreateDto.cs
Normal file
4
DigitalData.UserManager.DTO/DTOs/SearchRootCreateDto.cs
Normal file
@ -0,0 +1,4 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs
|
||||
{
|
||||
public record SearchRootCreateDto(string? DirEntryUsername, string DirEntryPassword);
|
||||
}
|
||||
18
DigitalData.UserManager.DTO/DTOs/User/UserCreateDto.cs
Normal file
18
DigitalData.UserManager.DTO/DTOs/User/UserCreateDto.cs
Normal file
@ -0,0 +1,18 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.User
|
||||
{
|
||||
public record class UserCreateDto
|
||||
{
|
||||
public string? Prename { get; init; }
|
||||
public string? Name { get; init; }
|
||||
public string? Username { get; init; }
|
||||
public string? Shortname { get; init; }
|
||||
public string? Email { get; init; }
|
||||
public string Language { get; init; } = "de-DE";
|
||||
public string? Comment { get; init; }
|
||||
public bool? Deleted { get; init; }
|
||||
public string DateFormat { get; init; } = "dd.MM.yyyy";
|
||||
public string AddedWho { get; init; } = "DEFAULT";
|
||||
public string? ChangedWho { get; init; }
|
||||
public bool Active { get; init; } = true;
|
||||
}
|
||||
}
|
||||
34
DigitalData.UserManager.DTO/DTOs/User/UserPrincipalDto.cs
Normal file
34
DigitalData.UserManager.DTO/DTOs/User/UserPrincipalDto.cs
Normal file
@ -0,0 +1,34 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.User
|
||||
{
|
||||
public record UserPrincipalDto
|
||||
(
|
||||
string SamAccountName,
|
||||
string GivenName,
|
||||
string? MiddleName,
|
||||
string Surname,
|
||||
string EmailAddress,
|
||||
string? AddedWho,
|
||||
string? DateFormat
|
||||
// Guid Guid,
|
||||
// string SId,
|
||||
// string EmployeeId,
|
||||
// string VoiceTelephoneNumber,
|
||||
// DateTime? AccountExpirationDate,
|
||||
// DateTime? AccountLockoutTime,
|
||||
// bool AllowReversiblePasswordEncryption,
|
||||
// int BadLogonCount,
|
||||
// bool DelegationPermitted,
|
||||
// bool? Enabled,
|
||||
// string HomeDirectory,
|
||||
// string HomeDrive,
|
||||
// DateTime? LastBadPasswordAttempt,
|
||||
// DateTime? LastLogon,
|
||||
// DateTime? LastPasswordSet,
|
||||
// bool PasswordNeverExpires,
|
||||
// bool PasswordNotRequired,
|
||||
// byte[] PermittedLogonTimes,
|
||||
// bool SmartcardLogonRequired,
|
||||
// bool UserCannotChangePassword
|
||||
);
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.User
|
||||
{
|
||||
public record UserPrincipalReadDto
|
||||
(
|
||||
Guid Guid,
|
||||
string SId,
|
||||
string EmployeeId,
|
||||
string SamAccountName,
|
||||
string GivenName,
|
||||
string MiddleName,
|
||||
string Surname,
|
||||
string EmailAddress
|
||||
);
|
||||
}
|
||||
17
DigitalData.UserManager.DTO/DTOs/User/UserReadDto.cs
Normal file
17
DigitalData.UserManager.DTO/DTOs/User/UserReadDto.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.User
|
||||
{
|
||||
public record UserReadDto(
|
||||
int Guid,
|
||||
string? Prename,
|
||||
string? Name,
|
||||
string Username,
|
||||
string? Shortname,
|
||||
string? Email,
|
||||
string Language,
|
||||
string? Comment,
|
||||
bool Deleted,
|
||||
string DateFormat,
|
||||
string AddedWho,
|
||||
bool Active
|
||||
);
|
||||
}
|
||||
18
DigitalData.UserManager.DTO/DTOs/User/UserUpdateDto.cs
Normal file
18
DigitalData.UserManager.DTO/DTOs/User/UserUpdateDto.cs
Normal file
@ -0,0 +1,18 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.User
|
||||
{
|
||||
public record UserUpdateDto(
|
||||
int Guid,
|
||||
string? Prename,
|
||||
string? Name,
|
||||
string? Username,
|
||||
string? Shortname,
|
||||
string? Email,
|
||||
string? Language,
|
||||
string? Comment,
|
||||
bool? Deleted,
|
||||
string? DateFormat,
|
||||
string? AddedWho,
|
||||
string? ChangedWho,
|
||||
bool? Active
|
||||
);
|
||||
}
|
||||
10
DigitalData.UserManager.DTO/DTOs/UserRep/UserRepCreateDto.cs
Normal file
10
DigitalData.UserManager.DTO/DTOs/UserRep/UserRepCreateDto.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
||||
{
|
||||
public record UserRepCreateDto(
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
string AddedWho,
|
||||
int RepUserId
|
||||
);
|
||||
}
|
||||
18
DigitalData.UserManager.DTO/DTOs/UserRep/UserRepReadDto.cs
Normal file
18
DigitalData.UserManager.DTO/DTOs/UserRep/UserRepReadDto.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
|
||||
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
||||
{
|
||||
public record UserRepReadDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
string AddedWho,
|
||||
int? RepUserId,
|
||||
UserReadDto? User,
|
||||
GroupReadDto? RepGroup,
|
||||
GroupReadDto? RightGroup,
|
||||
UserReadDto? RepUser
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
||||
{
|
||||
public record UserRepUpdateDto(
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
int RepUserId
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@ -0,0 +1,14 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class DirectoryMappingProfile : Profile
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "<Pending>")]
|
||||
public DirectoryMappingProfile()
|
||||
{
|
||||
//CreateMap<UserPrincipal, UserPrincipalDto>();
|
||||
//CreateMap<UserPrincipal, UserPrincipalReadDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class GroupMappingProfile : Profile
|
||||
{
|
||||
public GroupMappingProfile()
|
||||
{
|
||||
CreateMap<Group, GroupCreateDto>();
|
||||
CreateMap<Group, GroupReadDto>();
|
||||
CreateMap<Group, GroupUpdateDto>();
|
||||
|
||||
CreateMap<GroupCreateDto, Group>();
|
||||
CreateMap<GroupReadDto, Group>();
|
||||
CreateMap<GroupUpdateDto, Group>();
|
||||
|
||||
CreateMap<DirectoryGroupDto, Group>()
|
||||
.ForMember(group => group.EcmFkId, opt => opt.MapFrom(adGroup => 1))
|
||||
.ForMember(group => group.AdSync, opt => opt.MapFrom(adGroup => true))
|
||||
.ForMember(group => group.Internal, opt => opt.MapFrom(adGroup => false))
|
||||
.ForMember(group => group.Active, opt => opt.MapFrom(adGroup => true))
|
||||
.ForMember(group => group.Name, opt => opt.MapFrom(adGroup => adGroup.Samaccountname.ElementAt(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class GroupOfUserMappingProfile : Profile
|
||||
{
|
||||
public GroupOfUserMappingProfile()
|
||||
{
|
||||
CreateMap<GroupOfUser, GroupOfUserCreateDto>();
|
||||
CreateMap<GroupOfUser, GroupOfUserReadDto>();
|
||||
CreateMap<GroupOfUser, GroupOfUserUpdateDto>();
|
||||
|
||||
CreateMap<GroupOfUserCreateDto, GroupOfUser>();
|
||||
CreateMap<GroupOfUserReadDto, GroupOfUser>();
|
||||
CreateMap<GroupOfUserUpdateDto, GroupOfUser>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.Application.DTOs.Module;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class ModuleMappingProfile : Profile
|
||||
{
|
||||
public ModuleMappingProfile()
|
||||
{
|
||||
CreateMap<Module, ModuleDto>();
|
||||
CreateMap<Module, ModuleDto>();
|
||||
CreateMap<Module, ModuleDto>();
|
||||
|
||||
CreateMap<ModuleDto, Module>();
|
||||
CreateMap<ModuleDto, Module>();
|
||||
CreateMap<ModuleDto, Module>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class ModuleOfUserMappingProfile : Profile
|
||||
{
|
||||
public ModuleOfUserMappingProfile()
|
||||
{
|
||||
CreateMap<ModuleOfUser, ModuleOfUserCreateDto>();
|
||||
CreateMap<ModuleOfUser, ModuleOfUserReadDto>();
|
||||
CreateMap<ModuleOfUser, ModuleOfUserUpdateDto>();
|
||||
|
||||
CreateMap<ModuleOfUserCreateDto, ModuleOfUser>();
|
||||
CreateMap<ModuleOfUserReadDto, ModuleOfUser>();
|
||||
CreateMap<ModuleOfUserUpdateDto, ModuleOfUser>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class UserMappingProfile : Profile
|
||||
{
|
||||
public UserMappingProfile()
|
||||
{
|
||||
CreateMap<User, UserCreateDto>();
|
||||
CreateMap<User, UserReadDto>();
|
||||
CreateMap<User, UserUpdateDto>();
|
||||
|
||||
CreateMap<UserCreateDto, User>();
|
||||
CreateMap<UserReadDto, User>();
|
||||
CreateMap<UserUpdateDto, User>();
|
||||
|
||||
CreateMap<UserPrincipalDto, User>()
|
||||
.ForMember(user => user.Name, opt => opt.MapFrom(upDto => upDto.Surname))
|
||||
.ForMember(user => user.Prename, opt => opt.MapFrom(upDto => upDto.GivenName))
|
||||
.ForMember(user => user.Username, opt => opt.MapFrom(upDto => upDto.SamAccountName))
|
||||
.ForMember(user => user.Email, opt => opt.MapFrom(upDto => upDto.EmailAddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class UserRepMappingProfile : Profile
|
||||
{
|
||||
public UserRepMappingProfile()
|
||||
{
|
||||
CreateMap<UserRep, UserRepCreateDto>();
|
||||
CreateMap<UserRep, UserRepReadDto>();
|
||||
CreateMap<UserRep, UserRepUpdateDto>();
|
||||
|
||||
CreateMap<UserRepCreateDto, UserRep>();
|
||||
CreateMap<UserRepReadDto, UserRep>();
|
||||
CreateMap<UserRepUpdateDto, UserRep>();
|
||||
}
|
||||
}
|
||||
}
|
||||
7
DigitalData.UserManager.DataContracts/Class1.cs
Normal file
7
DigitalData.UserManager.DataContracts/Class1.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace DigitalData.UserManager.DataContracts
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Auth
|
||||
{
|
||||
public record AuthCheckDto (bool IsAuthenticated);
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Auth
|
||||
{
|
||||
public record LogInDto(string Username, string Password);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Group
|
||||
{
|
||||
public record DirectoryGroupDto
|
||||
(
|
||||
IEnumerable<string> Samaccountname
|
||||
//public string Name { get; set; }
|
||||
//public string ObjectSid { get; set; }
|
||||
//public string ObjectCategory { get; set; }
|
||||
//public int SamAccountType { get; set; }
|
||||
//public string DistinguishedName { get; set; }
|
||||
//public int InstanceType { get; set; }
|
||||
//public string CN { get; set; }
|
||||
//public string ObjectClass { get; set; }
|
||||
//public DateTime WhenChanged { get; set; }
|
||||
//public Guid ObjectGuid { get; set; }
|
||||
//public long UsnCreated { get; set; }
|
||||
//public int? GroupType { get; set; }
|
||||
//public DateTime? DsCorePropagationData { get; set; }
|
||||
//public int? AdminCount { get; set; }
|
||||
//public int? SystemFlags { get; set; }
|
||||
//public string Member { get; set; }
|
||||
//public string AdsPath { get; set; }
|
||||
//public long UsnChanged { get; set; }
|
||||
//public DateTime WhenCreated { get; set; }
|
||||
//public string Description { get; set; }
|
||||
//public bool? IsCriticalSystemObject { get; set; }
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Group
|
||||
{
|
||||
public record GroupCreateDto
|
||||
(
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
bool? Active,
|
||||
string? Comment,
|
||||
string? AddedWho,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Group
|
||||
{
|
||||
public record GroupReadDto
|
||||
(
|
||||
int Guid,
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
bool? Active,
|
||||
string? Comment,
|
||||
string? AddedWho,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Group
|
||||
{
|
||||
public record GroupUpdateDto
|
||||
(
|
||||
int Guid,
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
bool? Active,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserCreateDto(
|
||||
int UserId,
|
||||
int GroupId,
|
||||
string? Comment,
|
||||
string? AddedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using DigitalData.UserManager.DataContracts.DTOs.Group;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.User;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserReadDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int GroupId,
|
||||
string? Comment,
|
||||
string AddedWho,
|
||||
string? ChangedWho,
|
||||
UserReadDto User,
|
||||
GroupReadDto Group
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserUpdateDto(
|
||||
int Guid,
|
||||
int? UserId,
|
||||
int? GroupId,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Module
|
||||
{
|
||||
public record ModuleDto(
|
||||
int Guid,
|
||||
string? Name,
|
||||
string? ShortName
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserCreateDto(
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
bool IsAdmin,
|
||||
string? Comment,
|
||||
string? AddedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserReadDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
string? Comment,
|
||||
string? AddedWho,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserUpdateDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
bool? IsAdmin,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs
|
||||
{
|
||||
public record SearchRootCreateDto(string? DirEntryUsername, string DirEntryPassword);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record class UserCreateDto
|
||||
{
|
||||
public string? Prename { get; init; }
|
||||
public string? Name { get; init; }
|
||||
public string? Username { get; init; }
|
||||
public string? Shortname { get; init; }
|
||||
public string? Email { get; init; }
|
||||
public string Language { get; init; } = "de-DE";
|
||||
public string? Comment { get; init; }
|
||||
public bool? Deleted { get; init; }
|
||||
public string DateFormat { get; init; } = "dd.MM.yyyy";
|
||||
public string AddedWho { get; init; } = "DEFAULT";
|
||||
public string? ChangedWho { get; init; }
|
||||
public bool Active { get; init; } = true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record UserPrincipalDto
|
||||
(
|
||||
string SamAccountName,
|
||||
string GivenName,
|
||||
string? MiddleName,
|
||||
string Surname,
|
||||
string EmailAddress,
|
||||
string? AddedWho,
|
||||
string? DateFormat
|
||||
// Guid Guid,
|
||||
// string SId,
|
||||
// string EmployeeId,
|
||||
// string VoiceTelephoneNumber,
|
||||
// DateTime? AccountExpirationDate,
|
||||
// DateTime? AccountLockoutTime,
|
||||
// bool AllowReversiblePasswordEncryption,
|
||||
// int BadLogonCount,
|
||||
// bool DelegationPermitted,
|
||||
// bool? Enabled,
|
||||
// string HomeDirectory,
|
||||
// string HomeDrive,
|
||||
// DateTime? LastBadPasswordAttempt,
|
||||
// DateTime? LastLogon,
|
||||
// DateTime? LastPasswordSet,
|
||||
// bool PasswordNeverExpires,
|
||||
// bool PasswordNotRequired,
|
||||
// byte[] PermittedLogonTimes,
|
||||
// bool SmartcardLogonRequired,
|
||||
// bool UserCannotChangePassword
|
||||
);
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record UserPrincipalReadDto
|
||||
(
|
||||
Guid Guid,
|
||||
string SId,
|
||||
string EmployeeId,
|
||||
string SamAccountName,
|
||||
string GivenName,
|
||||
string MiddleName,
|
||||
string Surname,
|
||||
string EmailAddress
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record UserReadDto(
|
||||
int Guid,
|
||||
string? Prename,
|
||||
string? Name,
|
||||
string Username,
|
||||
string? Shortname,
|
||||
string? Email,
|
||||
string Language,
|
||||
string? Comment,
|
||||
bool Deleted,
|
||||
string DateFormat,
|
||||
string AddedWho,
|
||||
bool Active
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record UserUpdateDto(
|
||||
int Guid,
|
||||
string? Prename,
|
||||
string? Name,
|
||||
string? Username,
|
||||
string? Shortname,
|
||||
string? Email,
|
||||
string? Language,
|
||||
string? Comment,
|
||||
bool? Deleted,
|
||||
string? DateFormat,
|
||||
string? AddedWho,
|
||||
string? ChangedWho,
|
||||
bool? Active
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.UserRep
|
||||
{
|
||||
public record UserRepCreateDto(
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
string AddedWho,
|
||||
int RepUserId
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
using DigitalData.UserManager.DataContracts.DTOs.Group;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.User;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.UserRep
|
||||
{
|
||||
public record UserRepReadDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
string AddedWho,
|
||||
int? RepUserId,
|
||||
UserReadDto? User,
|
||||
GroupReadDto? RepGroup,
|
||||
GroupReadDto? RightGroup,
|
||||
UserReadDto? RepUser
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.UserRep
|
||||
{
|
||||
public record UserRepUpdateDto(
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
int RepUserId
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices" Version="7.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices.Protocols" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DigitalData.UserManager.Domain\DigitalData.UserManager.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -0,0 +1,16 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.User;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class DirectoryMappingProfile : Profile
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "<Pending>")]
|
||||
public DirectoryMappingProfile()
|
||||
{
|
||||
CreateMap<UserPrincipal, UserPrincipalDto>();
|
||||
CreateMap<UserPrincipal, UserPrincipalReadDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.Group;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class GroupMappingProfile : Profile
|
||||
{
|
||||
public GroupMappingProfile()
|
||||
{
|
||||
CreateMap<Group, GroupCreateDto>();
|
||||
CreateMap<Group, GroupReadDto>();
|
||||
CreateMap<Group, GroupUpdateDto>();
|
||||
|
||||
CreateMap<GroupCreateDto, Group>();
|
||||
CreateMap<GroupReadDto, Group>();
|
||||
CreateMap<GroupUpdateDto, Group>();
|
||||
|
||||
CreateMap<DirectoryGroupDto, Group>()
|
||||
.ForMember(group => group.EcmFkId, opt => opt.MapFrom(adGroup => 1))
|
||||
.ForMember(group => group.AdSync, opt => opt.MapFrom(adGroup => true))
|
||||
.ForMember(group => group.Internal, opt => opt.MapFrom(adGroup => false))
|
||||
.ForMember(group => group.Active, opt => opt.MapFrom(adGroup => true))
|
||||
.ForMember(group => group.Name, opt => opt.MapFrom(adGroup => adGroup.Samaccountname.ElementAt(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class GroupOfUserMappingProfile : Profile
|
||||
{
|
||||
public GroupOfUserMappingProfile()
|
||||
{
|
||||
CreateMap<GroupOfUser, GroupOfUserCreateDto>();
|
||||
CreateMap<GroupOfUser, GroupOfUserReadDto>();
|
||||
CreateMap<GroupOfUser, GroupOfUserUpdateDto>();
|
||||
|
||||
CreateMap<GroupOfUserCreateDto, GroupOfUser>();
|
||||
CreateMap<GroupOfUserReadDto, GroupOfUser>();
|
||||
CreateMap<GroupOfUserUpdateDto, GroupOfUser>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.Module;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class ModuleMappingProfile : Profile
|
||||
{
|
||||
public ModuleMappingProfile()
|
||||
{
|
||||
CreateMap<Module, ModuleDto>();
|
||||
CreateMap<Module, ModuleDto>();
|
||||
CreateMap<Module, ModuleDto>();
|
||||
|
||||
CreateMap<ModuleDto, Module>();
|
||||
CreateMap<ModuleDto, Module>();
|
||||
CreateMap<ModuleDto, Module>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class ModuleOfUserMappingProfile : Profile
|
||||
{
|
||||
public ModuleOfUserMappingProfile()
|
||||
{
|
||||
CreateMap<ModuleOfUser, ModuleOfUserCreateDto>();
|
||||
CreateMap<ModuleOfUser, ModuleOfUserReadDto>();
|
||||
CreateMap<ModuleOfUser, ModuleOfUserUpdateDto>();
|
||||
|
||||
CreateMap<ModuleOfUserCreateDto, ModuleOfUser>();
|
||||
CreateMap<ModuleOfUserReadDto, ModuleOfUser>();
|
||||
CreateMap<ModuleOfUserUpdateDto, ModuleOfUser>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class UserMappingProfile : Profile
|
||||
{
|
||||
public UserMappingProfile()
|
||||
{
|
||||
CreateMap<User, UserCreateDto>();
|
||||
CreateMap<User, UserReadDto>();
|
||||
CreateMap<User, UserUpdateDto>();
|
||||
|
||||
CreateMap<UserCreateDto, User>();
|
||||
CreateMap<UserReadDto, User>();
|
||||
CreateMap<UserUpdateDto, User>();
|
||||
|
||||
CreateMap<UserPrincipalDto, User>()
|
||||
.ForMember(user => user.Name, opt => opt.MapFrom(upDto => upDto.Surname))
|
||||
.ForMember(user => user.Prename, opt => opt.MapFrom(upDto => upDto.GivenName))
|
||||
.ForMember(user => user.Username, opt => opt.MapFrom(upDto => upDto.SamAccountName))
|
||||
.ForMember(user => user.Email, opt => opt.MapFrom(upDto => upDto.EmailAddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class UserRepMappingProfile : Profile
|
||||
{
|
||||
public UserRepMappingProfile()
|
||||
{
|
||||
CreateMap<UserRep, UserRepCreateDto>();
|
||||
CreateMap<UserRep, UserRepReadDto>();
|
||||
CreateMap<UserRep, UserRepUpdateDto>();
|
||||
|
||||
CreateMap<UserRepCreateDto, UserRep>();
|
||||
CreateMap<UserRepReadDto, UserRep>();
|
||||
CreateMap<UserRepUpdateDto, UserRep>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
04f7bc95c8dfbe37f9a09b5384752d3233030162
|
||||
e7442efa119506a35ea2bbf61e7f3b06da27621b46597296eb047a0a80f5aa80
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user