Integration des Active Directory Controllers und Active Directory Service abgeschlossen.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DigitalData.UserManager.API.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
public class DirectoryController : ControllerBase
|
||||
{
|
||||
private ILogger<DirectoryController> _logger;
|
||||
private IDirectoryService _dirService;
|
||||
|
||||
public DirectoryController(ILogger<DirectoryController> logger, IDirectoryService dirService)
|
||||
{
|
||||
_logger = logger;
|
||||
_dirService = dirService;
|
||||
}
|
||||
|
||||
[HttpGet("Group")]
|
||||
public IActionResult GetGroupAd(string? propName = null)
|
||||
{
|
||||
|
||||
if (propName is not null)
|
||||
return Ok(_dirService.ReadGroupByPropertyName(propName));
|
||||
else
|
||||
return Ok(_dirService.ReadAllGroupAsCollection());
|
||||
}
|
||||
|
||||
[HttpGet("User")]
|
||||
public IActionResult GetUserByGroupName([FromQuery] string groupName)
|
||||
{
|
||||
if(groupName is null)
|
||||
{
|
||||
return BadRequest(_dirService.Failed());
|
||||
}
|
||||
return Ok(_dirService.ReadUserByGroup<UserPrincipalReadDto>(groupIdentityValue:groupName));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user