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/obj/DigitalData.UserManager.API.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,100 +20,135 @@ namespace DigitalData.UserManager.API.Controllers
private readonly IGroupOfUserService _gouService;
private readonly IDirectorySearchService _dirSearchService;
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;
_gouService = gouService;
_dirSearchService = directorySearchService;
_localizer = localizer;
_logger = logger;
}
[AllowAnonymous]
[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]
[HttpPost("login")]
public async Task<IActionResult> Login([FromBody] LogInDto login)
{
bool isValid = _dirSearchService.ValidateCredentials(login.Username, login.Password);
if (!isValid)
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound]));
var gouMsg = await _gouService.HasGroup(login.Username, "PM_USER", caseSensitive:false);
if(!gouMsg.IsSuccess)
return Unauthorized(Result.Fail().Message(_localizer[Key.UnauthorizedUser]));
//find the user
var uRes = await _userService.ReadByUsernameAsync(login.Username);
if (!uRes.IsSuccess || uRes.Data is null)
try
{
return Unauthorized(uRes);
bool isValid = _dirSearchService.ValidateCredentials(login.Username, login.Password);
if (!isValid)
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound]));
var gouMsg = await _gouService.HasGroup(login.Username, "PM_USER", caseSensitive: false);
if (!gouMsg.IsSuccess)
return Unauthorized(Result.Fail().Message(_localizer[Key.UnauthorizedUser]));
//find the user
var uRes = await _userService.ReadByUsernameAsync(login.Username);
if (!uRes.IsSuccess || uRes.Data is null)
{
return Unauthorized(uRes);
}
UserReadDto user = uRes.Data;
// Create claims
var claims = new List<Claim>
{
new (ClaimTypes.NameIdentifier, user.Id.ToString()),
new (ClaimTypes.Name, user.Username),
new (ClaimTypes.Surname, user.Name ?? ""),
new (ClaimTypes.GivenName, user.Prename ?? ""),
new (ClaimTypes.Email, user.Email ?? ""),
new (ClaimTypes.Role, "PM_USER")
};
// Create claimsIdentity
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
// Create authProperties
var authProperties = new AuthenticationProperties
{
IsPersistent = true,
AllowRefresh = true,
ExpiresUtc = DateTime.UtcNow.AddMinutes(60)
};
// Sign in
await HttpContext.SignInAsync(
CookieAuthenticationDefaults.AuthenticationScheme,
new ClaimsPrincipal(claimsIdentity),
authProperties);
_dirSearchService.SetSearchRootCache(user.Username, login.Password);
return Ok();
}
UserReadDto user = uRes.Data;
// Create claims
var claims = new List<Claim>
catch(Exception ex)
{
new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
new Claim(ClaimTypes.Name, user.Username),
new Claim(ClaimTypes.Surname, user.Name ?? ""),
new Claim(ClaimTypes.GivenName, user.Prename ?? ""),
new Claim(ClaimTypes.Email, user.Email ?? ""),
new Claim(ClaimTypes.Role, "PM_USER")
};
// Create claimsIdentity
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
// Create authProperties
var authProperties = new AuthenticationProperties
{
IsPersistent = true,
AllowRefresh = true,
ExpiresUtc = DateTime.UtcNow.AddMinutes(60)
};
// Sign in
await HttpContext.SignInAsync(
CookieAuthenticationDefaults.AuthenticationScheme,
new ClaimsPrincipal(claimsIdentity),
authProperties);
_dirSearchService.SetSearchRootCache(user.Username, login.Password);
return Ok();
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[Authorize]
[HttpGet("user")]
public async Task<IActionResult> GetUserWithClaims()
{
// Extract the username from the Name claim.
string? username = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value;
if (string.IsNullOrEmpty(username))
return Unauthorized();
var userDto = await _userService.ReadByUsernameAsync(username);
if (!userDto.IsSuccess || userDto.Data is null)
try
{
return NotFound(Result.Fail().Message(_localizer[Key.UserNotFound]));
}
// Extract the username from the Name claim.
string? username = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value;
return Ok(userDto.Data);
if (string.IsNullOrEmpty(username))
return Unauthorized();
return await _userService.ReadByUsernameAsync(username)
.ThenAsync(Ok, IActionResult (m, n) =>
{
_logger.LogNotice(n);
return NotFound(Result.Fail().Message(_localizer[Key.UserNotFound]));
});
}
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[AllowAnonymous]
[Authorize]
[HttpPost("logout")]
public async Task<IActionResult> Logout()
{
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
return Ok();
try
{
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
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 Dictionary<string, string> _customSearchFilters;
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;
_userService = userService;
@@ -28,130 +29,187 @@ namespace DigitalData.UserManager.API.Controllers
var customSearchFiltersSection = configuration.GetSection("DirectorySearch:CustomSearchFilters");
_customSearchFilters = customSearchFiltersSection.Get<Dictionary<string, string>>() ?? new();
_logger = logger;
}
[HttpGet("Root/{username}")]
public IActionResult GetRootOf(string username)
{
var root = _dirSearchService.GetSearchRootCache(username);
return root is null ? NotFound() : Ok(new
try
{
guid = root.Guid,
nativeGuid = root.NativeGuid,
name = root.Name,
path = root.Path,
parentPath = root.Parent?.Path,
username = root.Username,
schemaClassName = root.SchemaClassName
});
var root = _dirSearchService.GetSearchRootCache(username);
return root is null ? NotFound() : Ok(new
{
guid = root.Guid,
nativeGuid = root.NativeGuid,
name = root.Name,
path = root.Path,
parentPath = root.Parent?.Path,
username = root.Username,
schemaClassName = root.SchemaClassName
});
}
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("CustomSearchFilter")]
public IActionResult GetAllCustomFilters(string? filtername)
{
if (filtername is null)
try
{
return Ok(_customSearchFilters);
if (filtername is null)
{
return Ok(_customSearchFilters);
}
else
{
_dirSearchService.CustomSearchFilters.TryGetValue(filtername, out string? filter);
return filter is null ? NotFound() : Ok(filter);
}
}
else
catch (Exception ex)
{
_dirSearchService.CustomSearchFilters.TryGetValue(filtername, out string? filter);
return filter is null ? NotFound() : Ok(filter);
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpPost("CreateSearchRoot")]
public async Task<IActionResult> CreateSearchRoot([FromBody] SearchRootCreateDto searchRootCreateDto)
{
var dirEntryUsername = searchRootCreateDto.DirEntryUsername ?? CurrentUser;
if (dirEntryUsername is null)
return Unauthorized();
try
{
var dirEntryUsername = searchRootCreateDto.DirEntryUsername ?? CurrentUser;
if (dirEntryUsername is null)
return Unauthorized();
bool isValid = _dirSearchService.ValidateCredentials(dirEntryUsername, searchRootCreateDto.DirEntryPassword);
bool isValid = _dirSearchService.ValidateCredentials(dirEntryUsername, searchRootCreateDto.DirEntryPassword);
if (!isValid)
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound]));
if (!isValid)
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound]));
var userResult = await _userService.ReadByUsernameAsync(dirEntryUsername);
if(!userResult.IsSuccess || userResult.Data is null)
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFoundInLocalDB]));
var userResult = await _userService.ReadByUsernameAsync(dirEntryUsername);
if (!userResult.IsSuccess || userResult.Data is null)
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFoundInLocalDB]));
_dirSearchService.SetSearchRootCache(userResult.Data.Username, searchRootCreateDto.DirEntryPassword);
return Ok();
_dirSearchService.SetSearchRootCache(userResult.Data.Username, searchRootCreateDto.DirEntryPassword);
return Ok();
}
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("SearchByFilter/{filter}")]
public IActionResult SearchByFilter([FromRoute] string filter, string? dirEntryUsername, params string[] propName)
{
dirEntryUsername ??= CurrentUser;
try
{
dirEntryUsername ??= CurrentUser;
if (dirEntryUsername is null)
return Unauthorized();
if (dirEntryUsername is null)
return Unauthorized();
var result = _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName);
return Ok(result);
var result = _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("SearchByFilterName/{filterName}")]
public IActionResult SearchByFilterName([FromRoute] string filterName, string? dirEntryUsername, params string[] propName)
{
dirEntryUsername ??= CurrentUser;
try
{
dirEntryUsername ??= CurrentUser;
if (dirEntryUsername is null)
return Unauthorized();
if (dirEntryUsername is null)
return Unauthorized();
_dirSearchService.CustomSearchFilters.TryGetValue(filterName, out string? filter);
_dirSearchService.CustomSearchFilters.TryGetValue(filterName, out string? filter);
if (filter is null)
return NotFound($"The filter named {filterName} does not exist.");
if (filter is null)
return NotFound($"The filter named {filterName} does not exist.");
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("Group")]
public IActionResult GetGroups(string? dirEntryUsername, params string[] propName)
{
dirEntryUsername ??= CurrentUser;
try
{
dirEntryUsername ??= CurrentUser;
if (dirEntryUsername is null)
return Unauthorized();
if (dirEntryUsername is null)
return Unauthorized();
_dirSearchService.CustomSearchFilters.TryGetValue("Group", out string? filter);
_dirSearchService.CustomSearchFilters.TryGetValue("Group", out string? filter);
if (filter is null)
throw new InvalidOperationException("The LDAP Group Search filter configuration is missing in your appsettings. Please ensure it's added under DirectorySearch:CustomSearchFilters:Group to enable group searches.");
if (filter is null)
throw new InvalidOperationException("The LDAP Group Search filter configuration is missing in your appsettings. Please ensure it's added under DirectorySearch:CustomSearchFilters:Group to enable group searches.");
var result = _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName);
var result = _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName);
return Ok(result);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("User")]
public IActionResult GetUsersByGroupName(string? dirEntryUsername, [FromQuery] string? groupName = null)
{
string[] propName = { "memberof", "samaccountname", "givenname", "sn", "mail" };
dirEntryUsername ??= CurrentUser;
try
{
string[] propName = { "memberof", "samaccountname", "givenname", "sn", "mail" };
dirEntryUsername ??= CurrentUser;
if (dirEntryUsername is null)
return Unauthorized();
if (dirEntryUsername is null)
return Unauthorized();
_dirSearchService.CustomSearchFilters.TryGetValue("User", out string? filter);
_dirSearchService.CustomSearchFilters.TryGetValue("User", out string? filter);
if (filter is null)
throw new InvalidOperationException("The LDAP User Search filter configuration is missing in your appsettings. Please ensure it's added under DirectorySearch:CustomSearchFilters:User to enable group searches.");
if (filter is null)
throw new InvalidOperationException("The LDAP User Search filter configuration is missing in your appsettings. Please ensure it's added under DirectorySearch:CustomSearchFilters:User to enable group searches.");
var result = _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName);
var result = _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName);
if (groupName is not null && result.IsSuccess && result.Data is not null)
result.Data = result.Data
.Where(rp => rp.PropertyNames.Cast<string>().Contains("memberof") &&
rp["memberof"].Cast<string>().Any(ldapDir => ldapDir.Contains(groupName)))
.ToList();
if (groupName is not null && result.IsSuccess && result.Data is not null)
result.Data = result.Data
.Where(rp => rp.PropertyNames.Cast<string>().Contains("memberof") &&
rp["memberof"].Cast<string>().Any(ldapDir => ldapDir.Contains(groupName)))
.ToList();
return Ok(result);
return Ok(result);
}
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
private string? CurrentUser

View File

@@ -2,14 +2,13 @@ using DigitalData.Core.API;
using DigitalData.UserManager.Application.Contracts;
using DigitalData.UserManager.Application.DTOs.Group;
using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace DigitalData.UserManager.API.Controllers
{
[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)
{
@@ -18,15 +17,23 @@ namespace DigitalData.UserManager.API.Controllers
[HttpPost("ByDir")]
public async Task<IActionResult> CreateByDir(DirectoryGroupDto adGroup)
{
var result = await _service.CreateAsync(adGroup);
if (result.IsSuccess)
try
{
var createdResource = new { Id = result.Data };
var actionName = nameof(GetById);
var routeValues = new { id = createdResource.Id };
return CreatedAtAction(actionName, routeValues, createdResource);
var result = await _service.CreateAsync(adGroup);
if (result.IsSuccess)
{
var createdResource = new { Id = result.Data };
var actionName = nameof(GetById);
var routeValues = new { id = createdResource.Id };
return CreatedAtAction(actionName, routeValues, createdResource);
}
return BadRequest(result);
}
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
return BadRequest(result);
}
}
}

View File

@@ -2,14 +2,13 @@ using DigitalData.Core.API;
using DigitalData.UserManager.Application.Contracts;
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace DigitalData.UserManager.API.Controllers
{
[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)
{
@@ -18,13 +17,21 @@ namespace DigitalData.UserManager.API.Controllers
[HttpDelete]
public async Task<IActionResult> Delete([FromQuery] int groupId, [FromQuery] int userId)
{
var result = await _service.DeleteAsyncByGroupUserId(groupId, userId);
if (result.IsSuccess)
try
{
return Ok(result);
}
var result = await _service.DeleteAsyncByGroupUserId(groupId, userId);
if (result.IsSuccess)
{
return Ok(result);
}
return BadRequest(result);
return BadRequest(result);
}
catch (Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[NonAction]
@@ -33,19 +40,35 @@ namespace DigitalData.UserManager.API.Controllers
[HttpGet]
public async Task<IActionResult> GetAll([FromQuery]bool withUser = false, [FromQuery]bool withGroup = false)
{
var result = await _service.ReadAllAsyncWith(withUser, withGroup);
if (result.IsSuccess)
try
{
return Ok(result);
}
var result = await _service.ReadAllAsyncWith(withUser, withGroup);
if (result.IsSuccess)
{
return Ok(result);
}
return NotFound(result);
return NotFound(result);
}
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("Has")]
public async Task<IActionResult> HasGroup([FromQuery] string username, [FromQuery] string groupname)
{
return Ok(await _service.HasGroup(username, groupname));
try
{
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.DTOs.Module;
using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authorization;
namespace DigitalData.UserManager.API.Controllers
{
[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)
{

View File

@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc;
namespace DigitalData.UserManager.API.Controllers
{
[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)
{
@@ -17,13 +17,21 @@ namespace DigitalData.UserManager.API.Controllers
[HttpDelete]
public async Task<IActionResult> Delete([FromQuery] int moduleId, [FromQuery]int userId)
{
var result = await _service.DeleteAsyncByModuleUserId(moduleId, userId);
if (result.IsSuccess)
try
{
return Ok(result);
}
var result = await _service.DeleteAsyncByModuleUserId(moduleId, userId);
if (result.IsSuccess)
{
return Ok(result);
}
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.DTOs.User;
using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace DigitalData.UserManager.API.Controllers
{
[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)
{
@@ -18,41 +16,73 @@ namespace DigitalData.UserManager.API.Controllers
[HttpGet("ByModuleId/{moduleId}")]
public async Task<IActionResult> GetByModuleId([FromRoute] int moduleId, [FromQuery]bool assigned = true)
{
var result = assigned ? await _service.ReadByModuleIdAsync(moduleId) : await _service.ReadUnassignedByModuleIdAsync(moduleId);
return Ok(result);
{
try
{
var result = assigned ? await _service.ReadByModuleIdAsync(moduleId) : await _service.ReadUnassignedByModuleIdAsync(moduleId);
return Ok(result);
}
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpGet("ByGroupId/{groupId}")]
public async Task<IActionResult> GetByGroupId([FromRoute] int groupId, [FromQuery] bool assigned = true)
{
var result = assigned ? await _service.ReadByGroupIdAsync(groupId) : await _service.ReadUnassignedByGroupIdAsync(groupId); ;
return Ok(result);
try
{
var result = assigned ? await _service.ReadByGroupIdAsync(groupId) : await _service.ReadUnassignedByGroupIdAsync(groupId); ;
return Ok(result);
}
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
[HttpPost("ByDir")]
public async Task<IActionResult> CreateByDir(UserPrincipalDto upDto)
{
var result = await _service.CreateAsync(upDto);
if (result.IsSuccess)
try
{
var createdResource = new { Id = result.Data };
var actionName = nameof(GetById);
var routeValues = new { id = createdResource.Id };
return CreatedAtAction(actionName, routeValues, createdResource);
var result = await _service.CreateAsync(upDto);
if (result.IsSuccess)
{
var createdResource = new { Id = result.Data };
var actionName = nameof(GetById);
var routeValues = new { id = createdResource.Id };
return CreatedAtAction(actionName, routeValues, createdResource);
}
return BadRequest(result);
}
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
return BadRequest(result);
}
[HttpGet("ByUsername/{username}")]
public virtual async Task<IActionResult> GetByUsername([FromRoute] string username)
{
var result = await _service.ReadByUsernameAsync(username);
if (result.IsSuccess)
try
{
return Ok(result);
var result = await _service.ReadByUsernameAsync(username);
if (result.IsSuccess)
{
return Ok(result);
}
return NotFound(result);
}
catch(Exception ex)
{
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
return NotFound(result);
}
}
}

View File

@@ -2,7 +2,6 @@
using DigitalData.UserManager.Application.Contracts;
using DigitalData.UserManager.Application.DTOs.UserRep;
using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Data.SqlClient;
@@ -10,7 +9,7 @@ using Microsoft.Data.SqlClient;
namespace DigitalData.UserManager.API.Controllers
{
[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)
{
@@ -24,30 +23,22 @@ namespace DigitalData.UserManager.API.Controllers
[HttpGet]
public async Task<IActionResult> GetAll(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null)
{
var result = await _service.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId);
if (result.IsSuccess)
{
return Ok(result);
}
return NotFound(result);
}
public override async Task<IActionResult> Create(UserRepCreateDto createDto)
{
try
{
return await base.Create(createDto);
var result = await _service.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId);
if (result.IsSuccess)
{
return Ok(result);
}
return NotFound(result);
}
catch (Exception ex)
{
var innerEx = ex.InnerException;
if (innerEx is SqlException)
return BadRequest(innerEx.Message);
else
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
_logger.LogError(ex, "{Message}", ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
}

View File

@@ -7,10 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DigitalData.Core.Abstractions" Version="1.0.0" />
<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="DigitalData.Core.API" Version="1.0.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.14" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
@@ -34,6 +31,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="ClientApp\" />
<Folder Include="wwwroot\" />
</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.Text.Json.Serialization;
using DigitalData.EmailProfilerDispatcher.Domain.Attributes;
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
namespace DigitalData.UserManager.Application.DTOs.User
{

View File

@@ -8,10 +8,8 @@
<ItemGroup>
<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.DTO" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.Infrastructure" Version="1.0.0" />
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction" Version="1.0.0" />
<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" />
@@ -23,22 +21,4 @@
<ProjectReference Include="..\DigitalData.UserManager.Infrastructure\DigitalData.UserManager.Infrastructure.csproj" />
</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>

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>
<ItemGroup>
<PackageReference Include="DigitalData.Core.Abstractions" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.Infrastructure" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.Infrastructure" Version="1.0.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.15">
<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"
},
"development": {
"proxyConfig": "proxy.conf.js",
"proxyConfig": "proxy.conf.json",
"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" />
<title>User Manager Portal</title>
<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"
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" />

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}.Release|Any CPU.ActiveCfg = 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.Build.0 = 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 = 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
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU