Exemplo n.º 1
0
        /// <summary>
        /// Maps the audit and queue.
        /// </summary>
        /// <param name="auditLogBO">The audit log bo.</param>
        /// <param name="auditAction">The audit action.</param>
        /// <param name="newDataModel">The new data model.</param>
        /// <param name="oldDataModel">The old data model.</param>
        /// <param name="countOfItems">The count of items.</param>
        /// <returns></returns>
        public static async Task MapAuditAndQueue(AuditLogBO auditLogBO, AuditAction auditAction, object newDataModel, object oldDataModel = null, int?countOfItems = null)
        {
            auditLogBO.Action    = auditAction;
            auditLogBO.AuditDate = DateTime.UtcNow;
            auditLogBO.NewValue  = JsonConvert.SerializeObject(newDataModel);

            if (oldDataModel != null)
            {
                auditLogBO.OldValue = JsonConvert.SerializeObject(oldDataModel);
            }

            if (string.IsNullOrEmpty(auditLogBO.Comments) && newDataModel != null)
            {
                Type type;
                if (newDataModel.GetType().IsGenericType)
                {
                    type = newDataModel.GetType().GetGenericArguments()[0];
                    auditLogBO.Comments = $"{Enum.GetName(typeof(AuditAction), auditAction)} action on a list of {type.Name}. {countOfItems} items have been selected.";
                }
                else
                {
                    type = newDataModel.GetType();
                    auditLogBO.Comments = $"{Enum.GetName(typeof(AuditAction), auditAction)} action on {type.Name}";
                }
            }

            var clonedAuditBO = new AuditLogBO();

            clonedAuditBO = clonedAuditBO.Clone(auditLogBO);

            await AuditLogHelper.QueueAudits(clonedAuditBO);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Generates a "User Authentication" logout event in the audit log, according to DICOM Supplement 95.
 /// </summary>
 /// <param name="username">The username or asserted username of the account that was logged out.</param>
 /// <param name="authenticationServer">The authentication server against which the operation was performed.</param>
 /// <param name="eventResult">The result of the operation.</param>
 /// <param name="sessionId">The ID of the session that is being logged out.</param>
 public static void LogLogout(string username, string sessionId, EventSource authenticationServer, EventResult eventResult)
 {
     AuditLogHelper.LogLogout(username, sessionId, authenticationServer, eventResult);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Generates a "User Authentication" logout event in the audit log, according to DICOM Supplement 95.
 /// </summary>
 /// <param name="username">The username or asserted username of the account that was logged out.</param>
 /// <param name="eventResult">The result of the operation.</param>
 /// <param name="sessionId">The ID of the session that is being logged out.</param>
 public static void LogLogout(string username, string sessionId, EventResult eventResult)
 {
     AuditLogHelper.LogLogout(username, sessionId, eventResult);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Generates a "User Authentication" login event in the audit log, according to DICOM Supplement 95,
 /// and a "Security Alert" event if the operation failed.
 /// </summary>
 /// <param name="username">The username or asserted username of the account that was logged in.</param>
 /// <param name="authenticationServer">The authentication server against which the operation was performed.</param>
 /// <param name="eventResult">The result of the operation.</param>
 public static void LogLogin(string username, EventSource authenticationServer, EventResult eventResult)
 {
     AuditLogHelper.LogLogin(username, authenticationServer, eventResult);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Generates a "User Authentication" login event in the audit log, according to DICOM Supplement 95,
 /// and a "Security Alert" event if the operation failed.
 /// </summary>
 /// <param name="username">The username or asserted username of the account that was logged in.</param>
 /// <param name="eventResult">The result of the operation.</param>
 public static void LogLogin(string username, EventResult eventResult)
 {
     AuditLogHelper.LogLogin(username, eventResult);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Logs an event to the audit log using the format as described in DICOM Supplement 95.
 /// </summary>
 /// <param name="message">The audit message to log.</param>
 public static void Log(DicomAuditHelper message)
 {
     AuditLogHelper.Log(message);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Generates a "Dicom Instances Accessed" update event in the audit log (with ActionCode of Delete), according to DICOM Supplement 95.
 /// </summary>
 /// <remarks>
 /// This method automatically separates different patients into separately logged events, as required by DICOM.
 ///
 /// We chose to impleemnt the DicomInstancesAccessed audit log, as opposed to the DicomStudyDeleted audit message because the whole
 /// study isn't being deleted, just a series.
 /// </remarks>
 /// <param name="aeTitles">The application entities from which the instances were accessed.</param>
 /// <param name="instances">The studies that the series belong that are being deleted.</param>
 /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
 /// <param name="eventResult">The result of the operation.</param>
 public static void LogDeleteSeries(IEnumerable <string> aeTitles, AuditedInstances instances, EventSource eventSource, EventResult eventResult)
 {
     AuditLogHelper.LogDeleteSeries(aeTitles, instances, eventSource, eventResult);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Generates a "Dicom Study Deleted" event in the audit log, according to DICOM Supplement 95.
 /// </summary>
 /// <remarks>
 /// This method automatically separates different patients into separately logged events, as required by DICOM.
 /// </remarks>
 /// <param name="aeTitle">The application entity from which the instances were deleted.</param>
 /// <param name="instances">The studies that were deleted.</param>
 /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
 /// <param name="eventResult">The result of the operation.</param>
 public static void LogDeleteStudies(string aeTitle, AuditedInstances instances, EventSource eventSource, EventResult eventResult)
 {
     AuditLogHelper.LogDeleteStudies(aeTitle, instances, eventSource, eventResult);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Generates a "Data Export" event in the audit log, according to DICOM Supplement 95.
 /// </summary>
 /// <remarks>
 /// One audit event is generated for each file system volume to which data is exported.
 /// If the audited instances are not on a file system, a single event is generated with an empty media identifier.
 /// </remarks>
 /// <param name="instances">The files that were exported.</param>
 /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
 /// <param name="eventResult">The result of the operation.</param>
 public static void LogExportStudies(AuditedInstances instances, EventSource eventSource, EventResult eventResult)
 {
     AuditLogHelper.LogExportStudies(instances, eventSource, EventSource.GetCurrentDicomAE(), eventResult);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Generates a "DICOM Instances Transferred" received event in the audit log, according to DICOM Supplement 95.
 /// </summary>
 /// <remarks>
 /// This method automatically separates different patients into separately logged events, as required by DICOM.
 /// </remarks>
 /// <param name="remoteAETitle">The application entity from which the transfer was completed.</param>
 /// <param name="remoteHostName">The hostname of the application entity from which the transfer was completed.</param>
 /// <param name="instances">The studies that were transferred.</param>
 /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
 /// <param name="eventResult">The result of the operation.</param>
 /// <param name="action">The action taken on the studies that were transferred.</param>
 public static void LogReceivedInstances(string remoteAETitle, string remoteHostName, AuditedInstances instances, EventSource eventSource, EventResult eventResult, EventReceiptAction action)
 {
     AuditLogHelper.LogReceivedInstances(LocalAETitle, remoteAETitle, remoteHostName, instances, eventSource, eventResult, action);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Generates a "Begin Transferring DICOM Instances" receive event in the audit log, according to DICOM Supplement 95.
 /// </summary>
 /// <remarks>
 /// This method automatically separates different patients into separately logged events, as required by DICOM.
 /// </remarks>
 /// <param name="remoteAETitle">The application entity from which the transfer was started.</param>
 /// <param name="remoteHostName">The hostname of the application entity from which the transfer was started.</param>
 /// <param name="instances">The studies that were requested for transfer.</param>
 /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
 /// <param name="eventResult">The result of the operation.</param>
 public static void LogBeginReceiveInstances(string remoteAETitle, string remoteHostName, AuditedInstances instances, EventSource eventSource, EventResult eventResult)
 {
     AuditLogHelper.LogBeginReceiveInstances(LocalAETitle, remoteAETitle, remoteHostName, instances, eventSource, eventResult);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Generates an (issued) "Query" event in the audit log, according to DICOM Supplement 95.
 /// </summary>
 /// <param name="remoteAETitle">The application entity on which the query is taking place.</param>
 /// <param name="remoteHostName">The hostname of the application entity on which the query is taking place.</param>
 /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
 /// <param name="eventResult">The result of the operation.</param>
 /// <param name="sopClassUid">The SOP Class Uid of the type of DICOM Query being issued</param>
 /// <param name="query">The dataset containing the DICOM query being issued</param>
 public static void LogQueryIssued(string remoteAETitle, string remoteHostName, EventSource eventSource, EventResult eventResult, string sopClassUid, DicomAttributeCollection query)
 {
     AuditLogHelper.LogQueryIssued(LocalAETitle, remoteAETitle, remoteHostName, eventSource, EventSource.GetCurrentDicomAE(), eventResult, sopClassUid, query);
 }