Mercurial > hg > orthanc
changeset 6260:84b8c79850ec
added the name of the source plugin in audit logs
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 10 Aug 2025 15:27:29 +0200 |
parents | e1c96ddca883 |
children | 016c25ae2915 |
files | OrthancServer/Plugins/Engine/OrthancPlugins.cpp OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Sun Aug 10 14:00:55 2025 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Sun Aug 10 15:27:29 2025 +0200 @@ -4789,7 +4789,9 @@ for (PImpl::AuditLogHandlers::const_iterator handler = pimpl_->auditLogHandlers_.begin(); handler != pimpl_->auditLogHandlers_.end(); ++handler) { - OrthancPluginErrorCode error = (*handler) (parameters.userId, parameters.resourceType, parameters.resourceId, parameters.action, parameters.logData, parameters.logDataSize); + OrthancPluginErrorCode error = (*handler) ( + parameters.userId, parameters.sourcePlugin, parameters.resourceType, + parameters.resourceId, parameters.action, parameters.logData, parameters.logDataSize); if (error != OrthancPluginErrorCode_Success) {
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h Sun Aug 10 14:00:55 2025 +0200 +++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h Sun Aug 10 15:27:29 2025 +0200 @@ -10593,6 +10593,7 @@ typedef struct { + const char* sourcePlugin; const char* userId; OrthancPluginResourceType resourceType; const char* resourceId; @@ -10614,6 +10615,8 @@ * relay the audit log to a message broker. * * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). + * @param sourcePlugin The name of the source plugin, to properly interpret the + * content of "action" and "logData". * @param userId A string that uniquely identifies the user or * entity that is executing the action on the resource. * @param resourceType The type of the resource this audit log relates to. @@ -10625,6 +10628,7 @@ ORTHANC_PLUGIN_SINCE_SDK("1.12.9") ORTHANC_PLUGIN_INLINE void OrthancPluginAuditLog( OrthancPluginContext* context, + const char* sourcePlugin, const char* userId, OrthancPluginResourceType resourceType, const char* resourceId, @@ -10633,6 +10637,7 @@ uint32_t logDataSize) { _OrthancPluginAuditLog m; + m.sourcePlugin = sourcePlugin; m.userId = userId; m.resourceType = resourceType; m.resourceId = resourceId; @@ -10646,8 +10651,12 @@ /** * @brief Callback to handle an audit log. * - * Signature of a callback function that handles an audit log in a plugin. - * + * Signature of a callback function that handles an audit log + * emitted by a source plugin. + * + * @param sourcePlugin The name of the source plugin. This information can + * be used to properly interpret the content of the "action" and + * "logData" arguments. * @param userId A string uniquely identifying the user or entity that is executing the action on the resource. * @param resourceType The type of the resource this log relates to. * @param resourceId The resource this log relates to. @@ -10658,6 +10667,7 @@ * @ingroup Callbacks **/ typedef OrthancPluginErrorCode (*OrthancPluginAuditLogHandler) ( + const char* sourcePlugin, const char* userId, OrthancPluginResourceType resourceType, const char* resourceId,