This commit is contained in:
@@ -291,6 +291,8 @@ namespace AyaNova.Api.Controllers
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get list of Customer / Head office Users
|
||||
/// (Rights to Customer object required)
|
||||
@@ -317,6 +319,27 @@ namespace AyaNova.Api.Controllers
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fetch user type (inside meaning staff or subcontractor or outside meaning customer or headoffice type user)
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>All "inside" Users (except Customer and HeadOffice type)</returns>
|
||||
[HttpGet("inside-type/{id}")]
|
||||
public async Task<IActionResult> GetInsideStatus(long id)
|
||||
{
|
||||
//This method is used by the Client UI to determine the correct edit form to show
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (!Authorized.HasSelectRole(HttpContext.Items, AyaType.User))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
var u = await ct.User.FirstOrDefaultAsync(z => z.Id == id);
|
||||
if (u == null)
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
return Ok(ApiOkResponse.Response(u.UserType != UserType.Customer && u.UserType != UserType.HeadOffice));
|
||||
}
|
||||
|
||||
//------------
|
||||
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user