Compare commits

...

15 Commits

Author SHA1 Message Date
Developer 02
f83b92ab63 Controller mit Fehlerbehandlung zu UserRepController hinzugefügt. 2024-07-01 16:37:46 +02:00
Developer 02
5b8b10f162 Aktualisierung des Pakets Core.API von 1.0.2 auf 1.0.2.1. Controller mit Fehlerbehandlung hinzugefügt. 2024-07-01 16:31:57 +02:00
Developer 02
846751d1b4 Aktualisierung des Pakets Core.API von 1.0.1 auf 1.0.2 2024-07-01 16:16:09 +02:00
Developer 02
d16097d1b1 Try-Catch zu UserRepController hinzugefügt 2024-07-01 15:55:10 +02:00
Developer 02
3a0edfe956 Try-Catch zu UserController hinzugefügt 2024-07-01 15:54:20 +02:00
Developer 02
2687837f2b Try-Catch zu ModuleOfUserController hinzugefügt 2024-07-01 15:51:57 +02:00
Developer 02
cef098f265 Try-Catch zum GroupOfUserController hinzugefügt 2024-07-01 15:50:48 +02:00
Developer 02
66d6fa1f71 Logger zu GroupController hinzugefügt 2024-07-01 15:47:16 +02:00
Developer 02
766e8d913d Logger zu DirectoryController hinzugefügt 2024-07-01 15:46:09 +02:00
Developer 02
d76623155a Logger zum AuthController hinzugefügt. 2024-07-01 15:42:17 +02:00
Developer 02
3bcd723fba Nuget-Paket EmailProfilerDispatcher hinzugefügt 2024-07-01 15:28:32 +02:00
Developer 02
a21fcbf1d4 Entfernen Sie die separate DTO-Ebene 2024-07-01 12:05:03 +02:00
Developer 02
bce90dc00b "base href" zu html hinzufügen 2024-07-01 12:02:34 +02:00
Developer 02
8be6388a66 Proxy-Konfiguration hinzufügen 2024-07-01 12:01:08 +02:00
Developer 02
9b93869c15 Gitignore aktualisieren 2024-07-01 12:00:43 +02:00
75 changed files with 364 additions and 848 deletions

2
.gitignore vendored
View File

@@ -144,3 +144,5 @@
/DigitalData.UserManager.API/bin/Debug/net7.0/System.IdentityModel.Tokens.Jwt.dll /DigitalData.UserManager.API/bin/Debug/net7.0/System.IdentityModel.Tokens.Jwt.dll
/DigitalData.UserManager.API/obj/DigitalData.UserManager.API.csproj.nuget.g.targets /DigitalData.UserManager.API/obj/DigitalData.UserManager.API.csproj.nuget.g.targets
/DigitalData.UserManager.Infrastructure/obj/DigitalData.UserManager.Infrastructure.csproj.nuget.g.targets /DigitalData.UserManager.Infrastructure/obj/DigitalData.UserManager.Infrastructure.csproj.nuget.g.targets
/DigitalData.UserManager.DTO/obj/
/DigitalData.UserManager.NgWebUI/ClientApp/.angular/cache/

View File

@@ -20,30 +20,45 @@ namespace DigitalData.UserManager.API.Controllers
private readonly IGroupOfUserService _gouService; private readonly IGroupOfUserService _gouService;
private readonly IDirectorySearchService _dirSearchService; private readonly IDirectorySearchService _dirSearchService;
private readonly IStringLocalizer<Resource> _localizer; private readonly IStringLocalizer<Resource> _localizer;
private readonly ILogger<AuthController> _logger;
public AuthController(IUserService userService, IGroupOfUserService gouService, IDirectorySearchService directorySearchService, IStringLocalizer<Resource> localizer) public AuthController(IUserService userService, IGroupOfUserService gouService, IDirectorySearchService directorySearchService, IStringLocalizer<Resource> localizer, ILogger<AuthController> logger)
{ {
_userService = userService; _userService = userService;
_gouService = gouService; _gouService = gouService;
_dirSearchService = directorySearchService; _dirSearchService = directorySearchService;
_localizer = localizer; _localizer = localizer;
_logger = logger;
} }
[AllowAnonymous] [AllowAnonymous]
[HttpGet("check")] [HttpGet("check")]
public IActionResult CheckAuthentication() => Ok(new AuthCheckDto(IsAuthenticated: User.Identity?.IsAuthenticated ?? false)); public IActionResult CheckAuthentication()
{
try
{
return Ok(new AuthCheckDto(IsAuthenticated: User.Identity?.IsAuthenticated ?? false));
}
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[AllowAnonymous] [AllowAnonymous]
[HttpPost("login")] [HttpPost("login")]
public async Task<IActionResult> Login([FromBody] LogInDto login) public async Task<IActionResult> Login([FromBody] LogInDto login)
{
try
{ {
bool isValid = _dirSearchService.ValidateCredentials(login.Username, login.Password); bool isValid = _dirSearchService.ValidateCredentials(login.Username, login.Password);
if (!isValid) if (!isValid)
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound])); return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound]));
var gouMsg = await _gouService.HasGroup(login.Username, "PM_USER", caseSensitive:false); var gouMsg = await _gouService.HasGroup(login.Username, "PM_USER", caseSensitive: false);
if(!gouMsg.IsSuccess) if (!gouMsg.IsSuccess)
return Unauthorized(Result.Fail().Message(_localizer[Key.UnauthorizedUser])); return Unauthorized(Result.Fail().Message(_localizer[Key.UnauthorizedUser]));
//find the user //find the user
@@ -58,12 +73,12 @@ namespace DigitalData.UserManager.API.Controllers
// Create claims // Create claims
var claims = new List<Claim> var claims = new List<Claim>
{ {
new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), new (ClaimTypes.NameIdentifier, user.Id.ToString()),
new Claim(ClaimTypes.Name, user.Username), new (ClaimTypes.Name, user.Username),
new Claim(ClaimTypes.Surname, user.Name ?? ""), new (ClaimTypes.Surname, user.Name ?? ""),
new Claim(ClaimTypes.GivenName, user.Prename ?? ""), new (ClaimTypes.GivenName, user.Prename ?? ""),
new Claim(ClaimTypes.Email, user.Email ?? ""), new (ClaimTypes.Email, user.Email ?? ""),
new Claim(ClaimTypes.Role, "PM_USER") new (ClaimTypes.Role, "PM_USER")
}; };
// Create claimsIdentity // Create claimsIdentity
@@ -87,10 +102,18 @@ namespace DigitalData.UserManager.API.Controllers
return Ok(); return Ok();
} }
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[Authorize] [Authorize]
[HttpGet("user")] [HttpGet("user")]
public async Task<IActionResult> GetUserWithClaims() public async Task<IActionResult> GetUserWithClaims()
{
try
{ {
// Extract the username from the Name claim. // Extract the username from the Name claim.
string? username = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value; string? username = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value;
@@ -98,22 +121,34 @@ namespace DigitalData.UserManager.API.Controllers
if (string.IsNullOrEmpty(username)) if (string.IsNullOrEmpty(username))
return Unauthorized(); return Unauthorized();
var userDto = await _userService.ReadByUsernameAsync(username); return await _userService.ReadByUsernameAsync(username)
.ThenAsync(Ok, IActionResult (m, n) =>
if (!userDto.IsSuccess || userDto.Data is null)
{ {
_logger.LogNotice(n);
return NotFound(Result.Fail().Message(_localizer[Key.UserNotFound])); return NotFound(Result.Fail().Message(_localizer[Key.UserNotFound]));
});
}
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
} }
return Ok(userDto.Data); [Authorize]
}
[AllowAnonymous]
[HttpPost("logout")] [HttpPost("logout")]
public async Task<IActionResult> Logout() public async Task<IActionResult> Logout()
{
try
{ {
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
return Ok(); return Ok();
} }
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
} }
} }

View File

@@ -19,8 +19,9 @@ namespace DigitalData.UserManager.API.Controllers
private readonly IDirectorySearchService _dirSearchService; private readonly IDirectorySearchService _dirSearchService;
private readonly Dictionary<string, string> _customSearchFilters; private readonly Dictionary<string, string> _customSearchFilters;
private readonly IStringLocalizer<Resource> _localizer; private readonly IStringLocalizer<Resource> _localizer;
private readonly ILogger<DirectoryController> _logger;
public DirectoryController(IConfiguration configuration, IStringLocalizer<Resource> localizer, IUserService userService, IDirectorySearchService directorySearchService) public DirectoryController(IConfiguration configuration, IStringLocalizer<Resource> localizer, IUserService userService, IDirectorySearchService directorySearchService, ILogger<DirectoryController> logger)
{ {
_localizer = localizer; _localizer = localizer;
_userService = userService; _userService = userService;
@@ -28,10 +29,13 @@ namespace DigitalData.UserManager.API.Controllers
var customSearchFiltersSection = configuration.GetSection("DirectorySearch:CustomSearchFilters"); var customSearchFiltersSection = configuration.GetSection("DirectorySearch:CustomSearchFilters");
_customSearchFilters = customSearchFiltersSection.Get<Dictionary<string, string>>() ?? new(); _customSearchFilters = customSearchFiltersSection.Get<Dictionary<string, string>>() ?? new();
_logger = logger;
} }
[HttpGet("Root/{username}")] [HttpGet("Root/{username}")]
public IActionResult GetRootOf(string username) public IActionResult GetRootOf(string username)
{
try
{ {
var root = _dirSearchService.GetSearchRootCache(username); var root = _dirSearchService.GetSearchRootCache(username);
@@ -46,9 +50,17 @@ namespace DigitalData.UserManager.API.Controllers
schemaClassName = root.SchemaClassName schemaClassName = root.SchemaClassName
}); });
} }
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("CustomSearchFilter")] [HttpGet("CustomSearchFilter")]
public IActionResult GetAllCustomFilters(string? filtername) public IActionResult GetAllCustomFilters(string? filtername)
{
try
{ {
if (filtername is null) if (filtername is null)
{ {
@@ -60,9 +72,17 @@ namespace DigitalData.UserManager.API.Controllers
return filter is null ? NotFound() : Ok(filter); return filter is null ? NotFound() : Ok(filter);
} }
} }
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpPost("CreateSearchRoot")] [HttpPost("CreateSearchRoot")]
public async Task<IActionResult> CreateSearchRoot([FromBody] SearchRootCreateDto searchRootCreateDto) public async Task<IActionResult> CreateSearchRoot([FromBody] SearchRootCreateDto searchRootCreateDto)
{
try
{ {
var dirEntryUsername = searchRootCreateDto.DirEntryUsername ?? CurrentUser; var dirEntryUsername = searchRootCreateDto.DirEntryUsername ?? CurrentUser;
if (dirEntryUsername is null) if (dirEntryUsername is null)
@@ -74,15 +94,23 @@ namespace DigitalData.UserManager.API.Controllers
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound])); return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound]));
var userResult = await _userService.ReadByUsernameAsync(dirEntryUsername); var userResult = await _userService.ReadByUsernameAsync(dirEntryUsername);
if(!userResult.IsSuccess || userResult.Data is null) if (!userResult.IsSuccess || userResult.Data is null)
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFoundInLocalDB])); return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFoundInLocalDB]));
_dirSearchService.SetSearchRootCache(userResult.Data.Username, searchRootCreateDto.DirEntryPassword); _dirSearchService.SetSearchRootCache(userResult.Data.Username, searchRootCreateDto.DirEntryPassword);
return Ok(); return Ok();
} }
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("SearchByFilter/{filter}")] [HttpGet("SearchByFilter/{filter}")]
public IActionResult SearchByFilter([FromRoute] string filter, string? dirEntryUsername, params string[] propName) public IActionResult SearchByFilter([FromRoute] string filter, string? dirEntryUsername, params string[] propName)
{
try
{ {
dirEntryUsername ??= CurrentUser; dirEntryUsername ??= CurrentUser;
@@ -92,9 +120,17 @@ namespace DigitalData.UserManager.API.Controllers
var result = _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName); var result = _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName);
return Ok(result); return Ok(result);
} }
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("SearchByFilterName/{filterName}")] [HttpGet("SearchByFilterName/{filterName}")]
public IActionResult SearchByFilterName([FromRoute] string filterName, string? dirEntryUsername, params string[] propName) public IActionResult SearchByFilterName([FromRoute] string filterName, string? dirEntryUsername, params string[] propName)
{
try
{ {
dirEntryUsername ??= CurrentUser; dirEntryUsername ??= CurrentUser;
@@ -110,9 +146,17 @@ namespace DigitalData.UserManager.API.Controllers
return Ok(result); return Ok(result);
} }
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("Group")] [HttpGet("Group")]
public IActionResult GetGroups(string? dirEntryUsername, params string[] propName) public IActionResult GetGroups(string? dirEntryUsername, params string[] propName)
{
try
{ {
dirEntryUsername ??= CurrentUser; dirEntryUsername ??= CurrentUser;
@@ -128,9 +172,17 @@ namespace DigitalData.UserManager.API.Controllers
return Ok(result); return Ok(result);
} }
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("User")] [HttpGet("User")]
public IActionResult GetUsersByGroupName(string? dirEntryUsername, [FromQuery] string? groupName = null) public IActionResult GetUsersByGroupName(string? dirEntryUsername, [FromQuery] string? groupName = null)
{
try
{ {
string[] propName = { "memberof", "samaccountname", "givenname", "sn", "mail" }; string[] propName = { "memberof", "samaccountname", "givenname", "sn", "mail" };
dirEntryUsername ??= CurrentUser; dirEntryUsername ??= CurrentUser;
@@ -153,6 +205,12 @@ namespace DigitalData.UserManager.API.Controllers
return Ok(result); return Ok(result);
} }
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
private string? CurrentUser private string? CurrentUser
{ {

View File

@@ -2,14 +2,13 @@ using DigitalData.Core.API;
using DigitalData.UserManager.Application.Contracts; using DigitalData.UserManager.Application.Contracts;
using DigitalData.UserManager.Application.DTOs.Group; using DigitalData.UserManager.Application.DTOs.Group;
using DigitalData.UserManager.Domain.Entities; using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace DigitalData.UserManager.API.Controllers namespace DigitalData.UserManager.API.Controllers
{ {
[Authorize] [Authorize]
public class GroupController : CRUDControllerBase<IGroupService, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int> public class GroupController : CRUDControllerBaseWithErrorHandling<IGroupService, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int>
{ {
public GroupController(ILogger<GroupController> logger, IGroupService service) : base(logger, service) public GroupController(ILogger<GroupController> logger, IGroupService service) : base(logger, service)
{ {
@@ -17,6 +16,8 @@ namespace DigitalData.UserManager.API.Controllers
[HttpPost("ByDir")] [HttpPost("ByDir")]
public async Task<IActionResult> CreateByDir(DirectoryGroupDto adGroup) public async Task<IActionResult> CreateByDir(DirectoryGroupDto adGroup)
{
try
{ {
var result = await _service.CreateAsync(adGroup); var result = await _service.CreateAsync(adGroup);
if (result.IsSuccess) if (result.IsSuccess)
@@ -28,5 +29,11 @@ namespace DigitalData.UserManager.API.Controllers
} }
return BadRequest(result); return BadRequest(result);
} }
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
} }
} }

View File

@@ -2,14 +2,13 @@ using DigitalData.Core.API;
using DigitalData.UserManager.Application.Contracts; using DigitalData.UserManager.Application.Contracts;
using DigitalData.UserManager.Application.DTOs.GroupOfUser; using DigitalData.UserManager.Application.DTOs.GroupOfUser;
using DigitalData.UserManager.Domain.Entities; using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace DigitalData.UserManager.API.Controllers namespace DigitalData.UserManager.API.Controllers
{ {
[Authorize] [Authorize]
public class GroupOfUserController : CRUDControllerBase<IGroupOfUserService, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser, int> public class GroupOfUserController : CRUDControllerBaseWithErrorHandling<IGroupOfUserService, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser, int>
{ {
public GroupOfUserController(ILogger<GroupOfUserController> logger, IGroupOfUserService service) : base(logger, service) public GroupOfUserController(ILogger<GroupOfUserController> logger, IGroupOfUserService service) : base(logger, service)
{ {
@@ -17,6 +16,8 @@ namespace DigitalData.UserManager.API.Controllers
[HttpDelete] [HttpDelete]
public async Task<IActionResult> Delete([FromQuery] int groupId, [FromQuery] int userId) public async Task<IActionResult> Delete([FromQuery] int groupId, [FromQuery] int userId)
{
try
{ {
var result = await _service.DeleteAsyncByGroupUserId(groupId, userId); var result = await _service.DeleteAsyncByGroupUserId(groupId, userId);
if (result.IsSuccess) if (result.IsSuccess)
@@ -26,12 +27,20 @@ namespace DigitalData.UserManager.API.Controllers
return BadRequest(result); return BadRequest(result);
} }
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[NonAction] [NonAction]
public override Task<IActionResult> GetAll() => base.GetAll(); public override Task<IActionResult> GetAll() => base.GetAll();
[HttpGet] [HttpGet]
public async Task<IActionResult> GetAll([FromQuery]bool withUser = false, [FromQuery]bool withGroup = false) public async Task<IActionResult> GetAll([FromQuery]bool withUser = false, [FromQuery]bool withGroup = false)
{
try
{ {
var result = await _service.ReadAllAsyncWith(withUser, withGroup); var result = await _service.ReadAllAsyncWith(withUser, withGroup);
if (result.IsSuccess) if (result.IsSuccess)
@@ -41,11 +50,25 @@ namespace DigitalData.UserManager.API.Controllers
return NotFound(result); return NotFound(result);
} }
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("Has")] [HttpGet("Has")]
public async Task<IActionResult> HasGroup([FromQuery] string username, [FromQuery] string groupname) public async Task<IActionResult> HasGroup([FromQuery] string username, [FromQuery] string groupname)
{
try
{ {
return Ok(await _service.HasGroup(username, groupname)); return Ok(await _service.HasGroup(username, groupname));
} }
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
} }
} }

View File

@@ -2,13 +2,12 @@ using DigitalData.Core.API;
using DigitalData.UserManager.Application.Contracts; using DigitalData.UserManager.Application.Contracts;
using DigitalData.UserManager.Application.DTOs.Module; using DigitalData.UserManager.Application.DTOs.Module;
using DigitalData.UserManager.Domain.Entities; using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
namespace DigitalData.UserManager.API.Controllers namespace DigitalData.UserManager.API.Controllers
{ {
[Authorize] [Authorize]
public class ModuleController : ReadControllerBase<IModuleService, ModuleDto, Module, int> public class ModuleController : ReadControllerBaseWithErrorHandling<IModuleService, ModuleDto, Module, int>
{ {
public ModuleController(ILogger<ModuleController> logger, IModuleService service) : base(logger, service) public ModuleController(ILogger<ModuleController> logger, IModuleService service) : base(logger, service)
{ {

View File

@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc;
namespace DigitalData.UserManager.API.Controllers namespace DigitalData.UserManager.API.Controllers
{ {
[Authorize] [Authorize]
public class ModuleOfUserController : CRUDControllerBase<IModuleOfUserService, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int> public class ModuleOfUserController : CRUDControllerBaseWithErrorHandling<IModuleOfUserService, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>
{ {
public ModuleOfUserController(ILogger<ModuleOfUserController> logger, IModuleOfUserService service) : base(logger, service) public ModuleOfUserController(ILogger<ModuleOfUserController> logger, IModuleOfUserService service) : base(logger, service)
{ {
@@ -16,6 +16,8 @@ namespace DigitalData.UserManager.API.Controllers
[HttpDelete] [HttpDelete]
public async Task<IActionResult> Delete([FromQuery] int moduleId, [FromQuery]int userId) public async Task<IActionResult> Delete([FromQuery] int moduleId, [FromQuery]int userId)
{
try
{ {
var result = await _service.DeleteAsyncByModuleUserId(moduleId, userId); var result = await _service.DeleteAsyncByModuleUserId(moduleId, userId);
if (result.IsSuccess) if (result.IsSuccess)
@@ -25,5 +27,11 @@ namespace DigitalData.UserManager.API.Controllers
return BadRequest(result); return BadRequest(result);
} }
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
} }
} }

View File

@@ -2,15 +2,13 @@ using DigitalData.Core.API;
using DigitalData.UserManager.Application.Contracts; using DigitalData.UserManager.Application.Contracts;
using DigitalData.UserManager.Application.DTOs.User; using DigitalData.UserManager.Application.DTOs.User;
using DigitalData.UserManager.Domain.Entities; using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace DigitalData.UserManager.API.Controllers namespace DigitalData.UserManager.API.Controllers
{ {
[Authorize] [Authorize]
public class UserController : CRUDControllerBase<IUserService, UserCreateDto, UserReadDto, UserUpdateDto, User, int> public class UserController : CRUDControllerBaseWithErrorHandling<IUserService, UserCreateDto, UserReadDto, UserUpdateDto, User, int>
{ {
public UserController(ILogger<UserController> logger, IUserService service) : base(logger, service) public UserController(ILogger<UserController> logger, IUserService service) : base(logger, service)
{ {
@@ -18,20 +16,38 @@ namespace DigitalData.UserManager.API.Controllers
[HttpGet("ByModuleId/{moduleId}")] [HttpGet("ByModuleId/{moduleId}")]
public async Task<IActionResult> GetByModuleId([FromRoute] int moduleId, [FromQuery]bool assigned = true) public async Task<IActionResult> GetByModuleId([FromRoute] int moduleId, [FromQuery]bool assigned = true)
{
try
{ {
var result = assigned ? await _service.ReadByModuleIdAsync(moduleId) : await _service.ReadUnassignedByModuleIdAsync(moduleId); var result = assigned ? await _service.ReadByModuleIdAsync(moduleId) : await _service.ReadUnassignedByModuleIdAsync(moduleId);
return Ok(result); return Ok(result);
} }
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("ByGroupId/{groupId}")] [HttpGet("ByGroupId/{groupId}")]
public async Task<IActionResult> GetByGroupId([FromRoute] int groupId, [FromQuery] bool assigned = true) public async Task<IActionResult> GetByGroupId([FromRoute] int groupId, [FromQuery] bool assigned = true)
{
try
{ {
var result = assigned ? await _service.ReadByGroupIdAsync(groupId) : await _service.ReadUnassignedByGroupIdAsync(groupId); ; var result = assigned ? await _service.ReadByGroupIdAsync(groupId) : await _service.ReadUnassignedByGroupIdAsync(groupId); ;
return Ok(result); return Ok(result);
} }
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpPost("ByDir")] [HttpPost("ByDir")]
public async Task<IActionResult> CreateByDir(UserPrincipalDto upDto) public async Task<IActionResult> CreateByDir(UserPrincipalDto upDto)
{
try
{ {
var result = await _service.CreateAsync(upDto); var result = await _service.CreateAsync(upDto);
if (result.IsSuccess) if (result.IsSuccess)
@@ -43,9 +59,17 @@ namespace DigitalData.UserManager.API.Controllers
} }
return BadRequest(result); return BadRequest(result);
} }
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("ByUsername/{username}")] [HttpGet("ByUsername/{username}")]
public virtual async Task<IActionResult> GetByUsername([FromRoute] string username) public virtual async Task<IActionResult> GetByUsername([FromRoute] string username)
{
try
{ {
var result = await _service.ReadByUsernameAsync(username); var result = await _service.ReadByUsernameAsync(username);
if (result.IsSuccess) if (result.IsSuccess)
@@ -54,5 +78,11 @@ namespace DigitalData.UserManager.API.Controllers
} }
return NotFound(result); return NotFound(result);
} }
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
} }
} }

View File

@@ -2,7 +2,6 @@
using DigitalData.UserManager.Application.Contracts; using DigitalData.UserManager.Application.Contracts;
using DigitalData.UserManager.Application.DTOs.UserRep; using DigitalData.UserManager.Application.DTOs.UserRep;
using DigitalData.UserManager.Domain.Entities; using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
@@ -10,7 +9,7 @@ using Microsoft.Data.SqlClient;
namespace DigitalData.UserManager.API.Controllers namespace DigitalData.UserManager.API.Controllers
{ {
[Authorize] [Authorize]
public class UserRepController : CRUDControllerBase<IUserRepService, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int> public class UserRepController : CRUDControllerBaseWithErrorHandling<IUserRepService, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>
{ {
public UserRepController(ILogger<UserRepController> logger, IUserRepService service) : base(logger, service) public UserRepController(ILogger<UserRepController> logger, IUserRepService service) : base(logger, service)
{ {
@@ -24,6 +23,8 @@ namespace DigitalData.UserManager.API.Controllers
[HttpGet] [HttpGet]
public async Task<IActionResult> GetAll(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null) public async Task<IActionResult> GetAll(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null)
{
try
{ {
var result = await _service.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId); var result = await _service.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId);
@@ -34,20 +35,10 @@ namespace DigitalData.UserManager.API.Controllers
return NotFound(result); return NotFound(result);
} }
public override async Task<IActionResult> Create(UserRepCreateDto createDto)
{
try
{
return await base.Create(createDto);
}
catch (Exception ex) catch (Exception ex)
{ {
var innerEx = ex.InnerException; _logger.LogError(ex, "{Message}", ex.Message);
if (innerEx is SqlException) return StatusCode(StatusCodes.Status500InternalServerError);
return BadRequest(innerEx.Message);
else
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
} }
} }
} }

View File

@@ -7,10 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DigitalData.Core.Abstractions" Version="1.0.0" /> <PackageReference Include="DigitalData.Core.API" Version="1.0.2.1" />
<PackageReference Include="DigitalData.Core.API" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.Application" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.DTO" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
@@ -34,6 +31,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="ClientApp\" />
<Folder Include="wwwroot\" /> <Folder Include="wwwroot\" />
</ItemGroup> </ItemGroup>

View File

@@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("DigitalData.UserManager.API")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("DigitalData.UserManager.API")]
[assembly: System.Reflection.AssemblyTitleAttribute("DigitalData.UserManager.API")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -1 +0,0 @@
4af23f4850bd99816ea88fa4ccf51033d1a51e9a

View File

@@ -1,17 +0,0 @@
is_global = true
build_property.TargetFramework = net7.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb = true
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = DigitalData.UserManager.API
build_property.RootNamespace = DigitalData.UserManager.API
build_property.ProjectDir = E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API\
build_property.RazorLangVersion = 7.0
build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.API
build_property._RazorSourceGeneratorDebug =

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using DigitalData.EmailProfilerDispatcher.Domain.Attributes; using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
namespace DigitalData.UserManager.Application.DTOs.User namespace DigitalData.UserManager.Application.DTOs.User
{ {

View File

@@ -8,10 +8,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" /> <PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="DigitalData.Core.Abstractions" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.Application" Version="1.0.0" /> <PackageReference Include="DigitalData.Core.Application" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.DTO" Version="1.0.0" /> <PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.Infrastructure" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" /> <PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
<PackageReference Include="System.DirectoryServices" Version="7.0.1" /> <PackageReference Include="System.DirectoryServices" Version="7.0.1" />
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.1" /> <PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.1" />
@@ -23,22 +21,4 @@
<ProjectReference Include="..\DigitalData.UserManager.Infrastructure\DigitalData.UserManager.Infrastructure.csproj" /> <ProjectReference Include="..\DigitalData.UserManager.Infrastructure\DigitalData.UserManager.Infrastructure.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="DigitalData.Core.Application">
<HintPath>..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.Application.dll</HintPath>
</Reference>
<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>
<Reference Include="DigitalData.Core.Infrastructure">
<HintPath>..\..\WebCoreModules\DigitalData.Core.Infrastructure\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="DigitalData.EmailProfilerDispatcher.Domain">
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Domain\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Domain.dll</HintPath>
</Reference>
</ItemGroup>
</Project> </Project>

View File

@@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("DigitalData.UserManager.Application")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("DigitalData.UserManager.Application")]
[assembly: System.Reflection.AssemblyTitleAttribute("DigitalData.UserManager.Application")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -1,11 +0,0 @@
is_global = true
build_property.TargetFramework = net7.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = DigitalData.UserManager.Application
build_property.ProjectDir = E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Application\

View File

@@ -1,7 +0,0 @@
namespace DigitalData.UserManager.DTO
{
public class Class1
{
}
}

View File

@@ -1,4 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.Auth
{
public record AuthCheckDto (bool IsAuthenticated);
}

View File

@@ -1,4 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.Auth
{
public record LogInDto(string Username, string Password);
}

View File

@@ -1,28 +0,0 @@
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; }
);
}

View File

@@ -1,13 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.Group
{
public record GroupCreateDto
(
string? Name,
bool? AdSync,
bool? Internal,
bool? Active,
string? Comment,
string? AddedWho,
string? ChangedWho
);
}

View File

@@ -1,14 +0,0 @@
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
);
}

View File

@@ -1,13 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.Group
{
public record GroupUpdateDto
(
int Guid,
string? Name,
bool? AdSync,
bool? Internal,
bool? Active,
string? Comment,
string? ChangedWho
);
}

View File

@@ -1,9 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
{
public record GroupOfUserCreateDto(
int UserId,
int GroupId,
string? Comment,
string? AddedWho
);
}

View File

@@ -1,16 +0,0 @@
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
);
}

View File

@@ -1,10 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
{
public record GroupOfUserUpdateDto(
int Guid,
int? UserId,
int? GroupId,
string? Comment,
string? ChangedWho
);
}

View File

@@ -1,8 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.Module
{
public record ModuleDto(
int Guid,
string? Name,
string? ShortName
);
}

View File

@@ -1,10 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
{
public record ModuleOfUserCreateDto(
int UserId,
int ModuleId,
bool IsAdmin,
string? Comment,
string? AddedWho
);
}

View File

@@ -1,11 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
{
public record ModuleOfUserReadDto(
int Guid,
int UserId,
int ModuleId,
string? Comment,
string? AddedWho,
string? ChangedWho
);
}

View File

@@ -1,11 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
{
public record ModuleOfUserUpdateDto(
int Guid,
int UserId,
int ModuleId,
bool? IsAdmin,
string? Comment,
string? ChangedWho
);
}

View File

@@ -1,4 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs
{
public record SearchRootCreateDto(string? DirEntryUsername, string DirEntryPassword);
}

View File

@@ -1,18 +0,0 @@
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;
}
}

View File

@@ -1,34 +0,0 @@
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
);
}

View File

@@ -1,14 +0,0 @@
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
);
}

View File

@@ -1,17 +0,0 @@
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
);
}

View File

@@ -1,18 +0,0 @@
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
);
}

View File

@@ -1,10 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.UserRep
{
public record UserRepCreateDto(
int UserId,
int? RepGroupId,
int RightGroupId,
string AddedWho,
int RepUserId
);
}

View File

@@ -1,18 +0,0 @@
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
);
}

View File

@@ -1,9 +0,0 @@
namespace DigitalData.UserManager.Application.DTOs.UserRep
{
public record UserRepUpdateDto(
int UserId,
int? RepGroupId,
int RightGroupId,
int RepUserId
);
}

View File

@@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -1,14 +0,0 @@
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>();
}
}
}

View File

@@ -1,27 +0,0 @@
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)));
}
}
}

View File

@@ -1,20 +0,0 @@
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>();
}
}
}

View File

@@ -1,20 +0,0 @@
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>();
}
}
}

View File

@@ -1,20 +0,0 @@
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>();
}
}
}

View File

@@ -1,26 +0,0 @@
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));
}
}
}

View File

@@ -1,20 +0,0 @@
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>();
}
}
}

View File

@@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("DigitalData.UserManager.Domain")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("DigitalData.UserManager.Domain")]
[assembly: System.Reflection.AssemblyTitleAttribute("DigitalData.UserManager.Domain")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -1 +0,0 @@
fcc50fa7ab4668cf3dfb07d56b7f096248f228dc

View File

@@ -1,11 +0,0 @@
is_global = true
build_property.TargetFramework = net7.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = DigitalData.UserManager.Domain
build_property.ProjectDir = E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Domain\

View File

@@ -7,8 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DigitalData.Core.Abstractions" Version="1.0.0" /> <PackageReference Include="DigitalData.Core.Infrastructure" Version="1.0.1.1" />
<PackageReference Include="DigitalData.Core.Infrastructure" Version="1.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.15"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.15">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>

View File

@@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("DigitalData.UserManager.Infrastructure")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("DigitalData.UserManager.Infrastructure")]
[assembly: System.Reflection.AssemblyTitleAttribute("DigitalData.UserManager.Infrastructure")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -1,11 +0,0 @@
is_global = true
build_property.TargetFramework = net7.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = DigitalData.UserManager.Infrastructure
build_property.ProjectDir = E:\TekH\Visual Studio\WebUserManager\DigitalData.UserManager.Infrastructure\

View File

@@ -80,7 +80,7 @@
"buildTarget": "DigitalData.UserManager.NgWebUI:build:production" "buildTarget": "DigitalData.UserManager.NgWebUI:build:production"
}, },
"development": { "development": {
"proxyConfig": "proxy.conf.js", "proxyConfig": "proxy.conf.json",
"buildTarget": "DigitalData.UserManager.NgWebUI:build:development" "buildTarget": "DigitalData.UserManager.NgWebUI:build:development"
} }
}, },

View File

@@ -1,19 +0,0 @@
const { env } = require('process');
const target = env.ASPNETCORE_HTTPS_PORT ? `https://localhost:${env.ASPNETCORE_HTTPS_PORT}` :
env.ASPNETCORE_URLS ? env.ASPNETCORE_URLS.split(';')[0] : 'http://localhost:62037';
const PROXY_CONFIG = [
{
context: [
"/weatherforecast",
],
target: target,
secure: false,
headers: {
Connection: 'Keep-Alive'
}
}
]
module.exports = PROXY_CONFIG;

View File

@@ -0,0 +1,7 @@
{
"/api": {
"target": "https://localhost:7202",
"secure": false,
"changeOrigin": true
}
}

View File

@@ -5,7 +5,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>User Manager Portal</title> <title>User Manager Portal</title>
<base href="/" /> <base href="/" />
<user-manager-api href="https://localhost:7202/api/" user-route="user" group-route="group" module-route="module" <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" 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" 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" /> login-route="auth/login" , logout-route="auth/logout" , login-check-route="auth/check" />

View File

@@ -27,8 +27,8 @@ Global
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.Build.0 = Debug|Any CPU {0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.Build.0 = Debug|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
{BFBD26C1-2E95-41EC-A5CC-F334CB2309A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BFBD26C1-2E95-41EC-A5CC-F334CB2309A8}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{BFBD26C1-2E95-41EC-A5CC-F334CB2309A8}.Debug|Any CPU.Build.0 = Debug|Any CPU {BFBD26C1-2E95-41EC-A5CC-F334CB2309A8}.Debug|Any CPU.Build.0 = Release|Any CPU
{BFBD26C1-2E95-41EC-A5CC-F334CB2309A8}.Release|Any CPU.ActiveCfg = Release|Any CPU {BFBD26C1-2E95-41EC-A5CC-F334CB2309A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFBD26C1-2E95-41EC-A5CC-F334CB2309A8}.Release|Any CPU.Build.0 = Release|Any CPU {BFBD26C1-2E95-41EC-A5CC-F334CB2309A8}.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 = Debug|Any CPU