예제 #1
0
        public async Task <ActionResult <JobStatusResponse> > StopJob([FromRoute] Guid jobId)
        {
            if (!await _authorizationService.IsUserAuthorizedToSeeJob(User.Identity.Name, jobId))
            {
                _eventTracker.TrackInfo("StopJob", $"User '{User.Identity.Name}' is not authorized to stop job '{jobId}'");
                return(Unauthorized());
            }

            var jobStatus = await _jobManagementService.StopJob(jobId);

            var response = new JobStatusResponse
            {
                JobId  = jobStatus.JobId,
                Status = jobStatus.Status,
            };

            return(Ok(response));
        }