This commit is contained in:
2018-09-26 19:40:18 +00:00
parent fbd6b249ab
commit e0fb8b916c
4 changed files with 60 additions and 61 deletions

View File

@@ -62,7 +62,7 @@ namespace AyaNova.Api.Controllers
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
}
if (!Authorized.IsAuthorizedToReadFullRecord(HttpContext.Items, AyaType.User))
if (!Authorized.IsAuthorizedToReadFullRecord(HttpContext.Items, UserBiz.BizType))
{
return StatusCode(401, new ApiNotAuthorizedResponse());
}
@@ -83,7 +83,7 @@ namespace AyaNova.Api.Controllers
}
//Log
EventLogProcessor.AddEntry(new Event(biz.UserId, o.Id, AyaType.User, AyaEvent.Retrieved), ct);
EventLogProcessor.AddEntry(new Event(biz.UserId, o.Id, UserBiz.BizType, AyaEvent.Retrieved), ct);
ct.SaveChanges();
return Ok(new ApiOkResponse(o));
}
@@ -107,7 +107,7 @@ namespace AyaNova.Api.Controllers
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
}
if (!Authorized.IsAuthorizedToReadFullRecord(HttpContext.Items, AyaType.User))
if (!Authorized.IsAuthorizedToReadFullRecord(HttpContext.Items, UserBiz.BizType))
{
return StatusCode(401, new ApiNotAuthorizedResponse());
}
@@ -190,7 +190,7 @@ namespace AyaNova.Api.Controllers
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
}
if (!Authorized.IsAuthorizedToModify(HttpContext.Items, AyaType.User, o.OwnerId))
if (!Authorized.IsAuthorizedToModify(HttpContext.Items, UserBiz.BizType, o.OwnerId))
{
return StatusCode(401, new ApiNotAuthorizedResponse());
}
@@ -257,7 +257,7 @@ namespace AyaNova.Api.Controllers
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
}
if (!Authorized.IsAuthorizedToModify(HttpContext.Items, AyaType.User, o.OwnerId))
if (!Authorized.IsAuthorizedToModify(HttpContext.Items, UserBiz.BizType, o.OwnerId))
{
return StatusCode(401, new ApiNotAuthorizedResponse());
}
@@ -304,7 +304,7 @@ namespace AyaNova.Api.Controllers
}
//If a user has change roles, or editOwnRoles then they can create, true is passed for isOwner since they are creating so by definition the owner
if (!Authorized.IsAuthorizedToCreate(HttpContext.Items, AyaType.User))
if (!Authorized.IsAuthorizedToCreate(HttpContext.Items, UserBiz.BizType))
{
return StatusCode(401, new ApiNotAuthorizedResponse());
}
@@ -366,7 +366,7 @@ namespace AyaNova.Api.Controllers
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
}
if (!Authorized.IsAuthorizedToDelete(HttpContext.Items, AyaType.User, dbObj.OwnerId))
if (!Authorized.IsAuthorizedToDelete(HttpContext.Items, UserBiz.BizType, dbObj.OwnerId))
{
return StatusCode(401, new ApiNotAuthorizedResponse());
}