This commit is contained in:
2019-05-20 21:35:50 +00:00
parent dd2b227d88
commit 0aad951ab1
6 changed files with 18 additions and 19 deletions

View File

@@ -186,14 +186,16 @@ namespace AyaNova.Api.Controllers
if (!badRequest)
{
//check if object exists
// long attachToObjectOwnerId = attachToObject.OwnerId(ct);
// if (attachToObjectOwnerId == -1)
// {
// badRequest = true;
// errorMessage = "Invalid attach object";
// }
// else
// {
//Updated code: this used to check if the ownerId was -1 to see if it didn't exist, but since ownerId zapped this seems like the next best way to do it
//Not sure at all what the ownerid check was doing before that verified it's existance, the code is long gone now and I can't be arsed to look it up in the repo history
//If the tests pass then it's fine :)
if (!BizObjectExistsInDatabase.Exists(attachToObject))
{
badRequest = true;
errorMessage = "Invalid attach object";
}
else
{
// User needs modify rights to the object type in question
if (!Authorized.HasModifyRole(HttpContext.Items, attachToObject.ObjectType))
{
@@ -202,7 +204,7 @@ namespace AyaNova.Api.Controllers
return StatusCode(403, new ApiNotAuthorizedResponse());
}
//}
}
}
@@ -222,7 +224,7 @@ namespace AyaNova.Api.Controllers
{
foreach (UploadedFileInfo a in uploadFormData.UploadedFiles)
{
var v = FileUtil.storeFileAttachment(a.InitialUploadedPathName, a.MimeType, a.OriginalFileName, UserId, attachToObject, ct);
var v = FileUtil.storeFileAttachment(a.InitialUploadedPathName, a.MimeType, a.OriginalFileName, attachToObject, ct);
returnList.Add(new NameIdItem()
{
Name = v.DisplayFileName,