This commit is contained in:
@@ -393,21 +393,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
return Ok(ApiOkResponse.Response(ret));
|
return Ok(ApiOkResponse.Response(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Utility to delete files that were uploaded but couldn't be stored for some reason, called by Attach route
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="uploadFormData"></param>
|
|
||||||
// private static void DeleteTempFileUploadDueToBadRequest(ApiUploadProcessor.ApiUploadedFilesResult uploadFormData)
|
|
||||||
// {
|
|
||||||
// if (uploadFormData.UploadedFiles.Count > 0)
|
|
||||||
// {
|
|
||||||
// foreach (UploadedFileInfo a in uploadFormData.UploadedFiles)
|
|
||||||
// {
|
|
||||||
// System.IO.File.Delete(a.InitialUploadedPathName);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete Attachment
|
/// Delete Attachment
|
||||||
|
|||||||
@@ -997,27 +997,6 @@ namespace AyaNova.Biz
|
|||||||
//Can delete?
|
//Can delete?
|
||||||
private async Task ValidateCanDelete(User inObj)
|
private async Task ValidateCanDelete(User inObj)
|
||||||
{
|
{
|
||||||
// //To make this simple and avoid a whole host of issues and work
|
|
||||||
// //I've decided that a user can't be deleted if they have *any* activity in the event log
|
|
||||||
// //this way a newly created user can be deleted before they do any real work still to cover a scenario where a user
|
|
||||||
// //makes a user but then doesn't need it or did it wrong
|
|
||||||
// //This avoids the whole issues related to having to check every table everywhere for their work and
|
|
||||||
// //the associated fuckery with trying to back them out of those tables without knock-on effects
|
|
||||||
// //They can always make any user inactive to get rid of them and it will mean referential integrity issues are not there
|
|
||||||
|
|
||||||
// //There's only one rule - have they done anything eventlog worthy yet?
|
|
||||||
// //if (await ct.Event.Select(z => z).Where(z => z.UserId == inObj.Id).Count() > 0)
|
|
||||||
// if (await ct.Event.AnyAsync(z => z.UserId == inObj.Id))
|
|
||||||
// {
|
|
||||||
// //Theres no more specific error to show for this
|
|
||||||
// AddError(ApiErrorCode.INVALID_OPERATION, "generalerror", await Translate("ErrorDBForeignKeyViolation"));
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//NOPE, the above is not going to fly for many reasons, going to have to do it the hard way
|
|
||||||
//Users need to know *what* is holding up deleting a user if they should choose to do so and
|
|
||||||
//the event log will eventually have a purge feature so it's not a reliable source
|
|
||||||
//the db would prevent it anyway, but it's best to do it right
|
|
||||||
|
|
||||||
//FOREIGN KEY CHECKS
|
//FOREIGN KEY CHECKS
|
||||||
if (await ct.Memo.AnyAsync(m => m.ToId == inObj.Id || m.FromId == inObj.Id))
|
if (await ct.Memo.AnyAsync(m => m.ToId == inObj.Id || m.FromId == inObj.Id))
|
||||||
|
|||||||
@@ -36,48 +36,10 @@ namespace AyaNova.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//UPDATE
|
//UPDATE
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//(never a create for this object)
|
||||||
|
|
||||||
//Creating a user creates a user options so no need for create ever
|
//PUT
|
||||||
|
|
||||||
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// //CREATE
|
|
||||||
// //
|
|
||||||
// internal async Task<UserOptions> CreateAsync(UserOptions newObject)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// User u = await ct.User.AsNoTracking().SingleOrDefaultAsync(z => z.Id == newObject.UserId);
|
|
||||||
// if (u == null)
|
|
||||||
// {
|
|
||||||
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// //Also used for Contacts (customer type user or ho type user)
|
|
||||||
// //by users with no User right but with Customer rights so need to double check here
|
|
||||||
// if (
|
|
||||||
// (u.IsOutsideUser && !Authorized.HasModifyRole(CurrentUserRoles, AyaType.Customer)) ||
|
|
||||||
// (!u.IsOutsideUser && !Authorized.HasModifyRole(CurrentUserRoles, AyaType.User))
|
|
||||||
// )
|
|
||||||
// {
|
|
||||||
// AddError(ApiErrorCode.NOT_AUTHORIZED);
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Validate(newObject);
|
|
||||||
// if (HasErrors)
|
|
||||||
// return null;
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
|
|
||||||
// await ct.UserOptions.AddAsync(newObject);
|
|
||||||
// await ct.SaveChangesAsync();
|
|
||||||
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
|
||||||
|
|
||||||
// return newObject;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
//put
|
|
||||||
internal async Task<bool> PutAsync(UserOptions dbObject, UserOptions inObj)
|
internal async Task<bool> PutAsync(UserOptions dbObject, UserOptions inObj)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user