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> // /// <summary>
/// Get list of Customer / Head office Users // /// Get list of Customer / Head office Users
/// (Rights to Customer object required) // /// (Rights to Customer object required)
/// </summary> // /// </summary>
/// <returns>All "outside" Users (No staff or contractors)</returns> // /// <returns>All "outside" Users (No staff or contractors)</returns>
[HttpGet("outlist")] // [HttpGet("outlist")]
public async Task<IActionResult> GetOutsideUserList() // public async Task<IActionResult> GetOutsideUserList()
{ // {
if (!serverState.IsOpen) // if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer)) // if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
return StatusCode(403, new ApiNotAuthorizedResponse()); // 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 // 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, // Id = z.Id,
Active = z.Active, // Active = z.Active,
Name = z.Name, // Name = z.Name,
UserType = z.UserType, // UserType = z.UserType,
LastLogin = z.LastLogin, // LastLogin = z.LastLogin,
EmailAddress = z.UserOptions.EmailAddress, // EmailAddress = z.UserOptions.EmailAddress,
Phone1 = z.UserOptions.Phone1, // Phone1 = z.UserOptions.Phone1,
Phone2 = z.UserOptions.Phone2, // Phone2 = z.UserOptions.Phone2,
Phone3 = z.UserOptions.Phone3, // Phone3 = z.UserOptions.Phone3,
Organization = z.HeadOffice.Name ?? z.Customer.Name // Organization = z.HeadOffice.Name ?? z.Customer.Name
}).ToListAsync(); // }).ToListAsync();
return Ok(ApiOkResponse.Response(ret)); // return Ok(ApiOkResponse.Response(ret));
} // }
/// <summary> /// <summary>
/// Get list of Customer Contact Users /// Get list of Customer Contact Users