This commit is contained in:
2020-12-08 19:48:27 +00:00
parent f606204f61
commit 20bee25755

View File

@@ -248,36 +248,36 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get list of Customer / Head office Users
/// (Rights to Customer object required)
/// </summary>
/// <returns>All "outside" Users (No staff or contractors)</returns>
[HttpGet("outlist")]
public async Task<IActionResult> GetOutsideUserList()
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
// /// <summary>
// /// Get list of Customer / Head office Users
// /// (Rights to Customer object required)
// /// </summary>
// /// <returns>All "outside" Users (No staff or contractors)</returns>
// [HttpGet("outlist")]
// public async Task<IActionResult> GetOutsideUserList()
// {
// if (!serverState.IsOpen)
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
return StatusCode(403, new ApiNotAuthorizedResponse());
// if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
// return StatusCode(403, new ApiNotAuthorizedResponse());
var ret = await ct.User.Include(c => c.Customer).Include(h => h.HeadOffice).Include(o => o.UserOptions).Where(z => z.UserType == UserType.Customer || z.UserType == UserType.HeadOffice).Select(z => new
{
Id = z.Id,
Active = z.Active,
Name = z.Name,
UserType = z.UserType,
LastLogin = z.LastLogin,
EmailAddress = z.UserOptions.EmailAddress,
Phone1 = z.UserOptions.Phone1,
Phone2 = z.UserOptions.Phone2,
Phone3 = z.UserOptions.Phone3,
Organization = z.HeadOffice.Name ?? z.Customer.Name
// var ret = await ct.User.Include(c => c.Customer).Include(h => h.HeadOffice).Include(o => o.UserOptions).Where(z => z.UserType == UserType.Customer || z.UserType == UserType.HeadOffice).Select(z => new
// {
// Id = z.Id,
// Active = z.Active,
// Name = z.Name,
// UserType = z.UserType,
// LastLogin = z.LastLogin,
// EmailAddress = z.UserOptions.EmailAddress,
// Phone1 = z.UserOptions.Phone1,
// Phone2 = z.UserOptions.Phone2,
// Phone3 = z.UserOptions.Phone3,
// Organization = z.HeadOffice.Name ?? z.Customer.Name
}).ToListAsync();
return Ok(ApiOkResponse.Response(ret));
}
// }).ToListAsync();
// return Ok(ApiOkResponse.Response(ret));
// }
/// <summary>
/// Get list of Customer Contact Users