From c10f565c158a07057439fb7830dad0d4ad18a4ed Mon Sep 17 00:00:00 2001 From: vsvaton <vaclav.svaton@vsb.cz> Date: Mon, 19 Nov 2018 13:45:37 +0100 Subject: [PATCH] Delete job fix and wrong credentials exception handler fix Delete job is enabled for Configuring state (before job submission to queue). Fix for unhandled exception during login with the wrong username. --- BusinessLogicTier/Logic/JobManagement/JobManagementLogic.cs | 2 +- .../UserAndLimitationManagementLogic.cs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/BusinessLogicTier/Logic/JobManagement/JobManagementLogic.cs b/BusinessLogicTier/Logic/JobManagement/JobManagementLogic.cs index 54c4611..8ef759d 100644 --- a/BusinessLogicTier/Logic/JobManagement/JobManagementLogic.cs +++ b/BusinessLogicTier/Logic/JobManagement/JobManagementLogic.cs @@ -90,7 +90,7 @@ namespace HaaSMiddleware.BusinessLogicTier.Logic.JobManagement { { log.Info("User " + loggedUser.GetLogIdentification() + " is deleting the job with info Id " + submittedJobInfoId); SubmittedJobInfo jobInfo = GetSubmittedJobInfoById(submittedJobInfoId, loggedUser); - if (jobInfo.State >= JobState.Finished) + if (jobInfo.State == JobState.Configuring || jobInfo.State >= JobState.Finished) { #warning Renci SSH.NET bug - resolving paths when deleting symlink, use ssh delete instead //FileSystemFactory.GetInstance(jobInfo.NodeType.FileTransferMethod.Protocol) diff --git a/BusinessLogicTier/Logic/UserAndLimitationManagement/UserAndLimitationManagementLogic.cs b/BusinessLogicTier/Logic/UserAndLimitationManagement/UserAndLimitationManagementLogic.cs index 4d591f5..f14741d 100644 --- a/BusinessLogicTier/Logic/UserAndLimitationManagement/UserAndLimitationManagementLogic.cs +++ b/BusinessLogicTier/Logic/UserAndLimitationManagement/UserAndLimitationManagementLogic.cs @@ -44,7 +44,11 @@ namespace HaaSMiddleware.BusinessLogicTier.Logic.UserAndLimitationManagement { // Get user AdaptorUser user = unitOfWork.AdaptorUserRepository.GetByName(credentials.Username); - if ( user.Deleted ) { + if (user == null) { + log.Error("Authentication of user " + credentials.Username + " was not successful due to wrong credentials."); + throw new InvalidAuthenticationCredentialsException("Authentication of user " + credentials.Username + " was not successful due to wrong credentials."); + } + if ( user.Deleted ) { log.Error("User " + user.Username + " that requested authentication was already deleted from the system."); throw new AuthenticatedUserAlreadyDeletedException("User " + user.Username + " that requested authentication was already deleted from the system."); } -- GitLab