Result und DataResult Callbacks wurden zu Controllern hinzugefügt.
This commit is contained in:
@@ -117,8 +117,11 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
if (dirEntryUsername is null)
|
||||
return Unauthorized();
|
||||
|
||||
var result = _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName);
|
||||
return Ok(result);
|
||||
return _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName).Then(Ok, IActionResult (m, n) =>
|
||||
{
|
||||
_logger.LogNotice(n);
|
||||
return StatusCode(StatusCodes.Status424FailedDependency);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -142,9 +145,11 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
if (filter is null)
|
||||
return NotFound($"The filter named {filterName} does not exist.");
|
||||
|
||||
var result = _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName);
|
||||
|
||||
return Ok(result);
|
||||
return _dirSearchService.FindAllByUserCache(dirEntryUsername, filter, properties: propName).Then(Ok, IActionResult (m, n) =>
|
||||
{
|
||||
_logger.LogNotice(n);
|
||||
return StatusCode(StatusCodes.Status424FailedDependency);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -168,9 +173,11 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
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);
|
||||
|
||||
return Ok(result);
|
||||
return _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName).Then(Ok, IActionResult (m, n) =>
|
||||
{
|
||||
_logger.LogNotice(n);
|
||||
return StatusCode(StatusCodes.Status424FailedDependency);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -195,15 +202,21 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
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);
|
||||
|
||||
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 _dirSearchService.FindAllByUserCache(username: dirEntryUsername, filter, properties: propName).Then(
|
||||
Success: data =>
|
||||
{
|
||||
if (groupName is not null)
|
||||
data = data
|
||||
.Where(rp => rp.PropertyNames.Cast<string>().Contains("memberof") &&
|
||||
rp["memberof"].Cast<string>().Any(ldapDir => ldapDir.Contains(groupName)))
|
||||
.ToList();
|
||||
return Ok(data);
|
||||
},
|
||||
Fail: IActionResult (m, n) =>
|
||||
{
|
||||
_logger.LogNotice(n);
|
||||
return StatusCode(StatusCodes.Status424FailedDependency);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user