This commit is contained in:
2020-01-21 19:38:08 +00:00
parent c897a47059
commit e5a04667aa
4 changed files with 125 additions and 130 deletions

View File

@@ -88,70 +88,70 @@ namespace AyaNova.Api.Controllers
}
/// <summary>
/// Get paged list of Users
///
/// Required roles:
/// BizAdminFull, BizAdminLimited
///
/// </summary>
/// <returns>Paged collection of Users with paging data</returns>
[HttpGet("ListUsers", Name = nameof(ListUsers))]//We MUST have a "Name" defined or we can't get the link for the pagination, non paged urls don't need a name
public async Task<IActionResult> ListUsers([FromQuery] ListOptions pagingOptions)
{
// /// <summary>
// /// Get paged list of Users
// ///
// /// Required roles:
// /// BizAdminFull, BizAdminLimited
// ///
// /// </summary>
// /// <returns>Paged collection of Users with paging data</returns>
// [HttpGet("ListUsers", Name = nameof(ListUsers))]//We MUST have a "Name" defined or we can't get the link for the pagination, non paged urls don't need a name
// public async Task<IActionResult> ListUsers([FromQuery] ListOptions pagingOptions)
// {
if (serverState.IsClosed)
{
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
}
// if (serverState.IsClosed)
// {
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// }
//Instantiate the business object handler
UserBiz biz = UserBiz.GetBiz(ct, HttpContext);
// //Instantiate the business object handler
// UserBiz biz = UserBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
{
return StatusCode(403, new ApiNotAuthorizedResponse());
}
// if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
// {
// return StatusCode(403, new ApiNotAuthorizedResponse());
// }
if (!ModelState.IsValid)
{
return BadRequest(new ApiErrorResponse(ModelState));
}
// if (!ModelState.IsValid)
// {
// return BadRequest(new ApiErrorResponse(ModelState));
// }
ApiPagedResponse<System.Object> pr = await biz.GetManyAsync(Url, nameof(ListUsers), pagingOptions);
return Ok(new ApiOkWithPagingResponse<System.Object>(pr));
}
// ApiPagedResponse<System.Object> pr = await biz.GetManyAsync(Url, nameof(ListUsers), pagingOptions);
// return Ok(new ApiOkWithPagingResponse<System.Object>(pr));
// }
/// <summary>
/// Get User pick list
///
/// Required roles: Any
///
/// </summary>
/// <param name="pagingOptions">Paging, filtering and sorting options</param>
/// <returns>Paged id/name collection with paging data</returns>
[HttpGet("PickList", Name = nameof(UserPickList))]
public ActionResult UserPickList([FromQuery] ListOptions pagingOptions)
{
if (serverState.IsClosed)
{
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
}
// /// <summary>
// /// Get User pick list
// ///
// /// Required roles: Any
// ///
// /// </summary>
// /// <param name="pagingOptions">Paging, filtering and sorting options</param>
// /// <returns>Paged id/name collection with paging data</returns>
// [HttpGet("PickList", Name = nameof(UserPickList))]
// public ActionResult UserPickList([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// {
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// }
if (!ModelState.IsValid)
{
return BadRequest(new ApiErrorResponse(ModelState));
}
// if (!ModelState.IsValid)
// {
// return BadRequest(new ApiErrorResponse(ModelState));
// }
//Instantiate the business object handler
UserBiz biz = UserBiz.GetBiz(ct, HttpContext);
ApiPagedResponse<NameIdItem> pr = biz.GetPickList(Url, nameof(UserPickList), pagingOptions);
return Ok(new ApiOkWithPagingResponse<NameIdItem>(pr));
}
// //Instantiate the business object handler
// UserBiz biz = UserBiz.GetBiz(ct, HttpContext);
// ApiPagedResponse<NameIdItem> pr = biz.GetPickList(Url, nameof(UserPickList), pagingOptions);
// return Ok(new ApiOkWithPagingResponse<NameIdItem>(pr));
// }
/// <summary>