This commit is contained in:
2020-12-07 17:51:52 +00:00
parent f25706b02e
commit e6e77f121d
3 changed files with 87 additions and 12 deletions

View File

@@ -77,13 +77,11 @@ namespace AyaNova.Api.Controllers
var o = await biz.GetAsync(id);
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
bool IsOutsideUser = (o.UserType == UserType.Customer || o.UserType == UserType.HeadOffice);
if (IsOutsideUser && !AllowedOutsideUser)
if (o.IsOutsideUser && !AllowedOutsideUser)
return StatusCode(403, new ApiNotAuthorizedResponse());
if (!IsOutsideUser && !AllowedInsideUser)
if (!o.IsOutsideUser && !AllowedInsideUser)
return StatusCode(403, new ApiNotAuthorizedResponse());
return Ok(ApiOkResponse.Response(o));