# HG changeset patch # User Alain Mazy # Date 1754926488 -7200 # Node ID 74c2ce776b811212c99d370bb13eb70ef9f4e0c7 # Parent 05de982f6cdf002d0db05ca87f46f7ce82fbc853 cleanup + rename action (missing -job) + add UserData to /modify diff -r 05de982f6cdf -r 74c2ce776b81 Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Mon Aug 11 12:23:27 2025 +0200 +++ b/Plugin/Plugin.cpp Mon Aug 11 17:34:48 2025 +0200 @@ -696,41 +696,38 @@ OrthancPluginResourceType jobResourceType = OrthancPlugins::StringToResourceType(jobContent["Type"].asString().c_str()); bool isAnonymization = jobContent.isMember("IsAnonymization") && jobContent["IsAnonymization"].asBool(); - LOG(WARNING) << jobContent.toStyledString(); + // LOG(WARNING) << jobContent.toStyledString(); - if (isAnonymization) + std::string userId; + if (GetUserIdFromUserData(userId, job)) { - std::string userId; - if (GetUserIdFromUserData(userId, job)) { - { - // attach a log to the source study - Json::Value logData; - logData["ModifiedResourceId"] = modifiedResourceId; - logData["ModifiedResourceType"] = jobResourceType; + // attach a log to the source study + Json::Value logData; + logData["ModifiedResourceId"] = modifiedResourceId; + logData["ModifiedResourceType"] = jobResourceType; - RecordAuditLog(userId, - jobResourceType, - sourceResourceId, - // TODO: "isAnonymization" is always true because of "if" => why this test? - (isAnonymization ? "success-anonymization" : "success-modification-job"), - logData); - } - - // attach a log to the modified study - if (sourceResourceId != modifiedResourceId) - { - Json::Value logData; - logData["SourceResourceId"] = sourceResourceId; - logData["SourceResourceType"] = jobResourceType; + RecordAuditLog(userId, + jobResourceType, + sourceResourceId, + // TODO: "isAnonymization" is always true because of "if" => why this test? + (isAnonymization ? "success-anonymization-job" : "success-modification-job"), + logData); + } + + // attach a log to the modified study + if (sourceResourceId != modifiedResourceId) + { + Json::Value logData; + logData["SourceResourceId"] = sourceResourceId; + logData["SourceResourceType"] = jobResourceType; - RecordAuditLog(userId, - jobResourceType, - modifiedResourceId, - // TODO: "isAnonymization" is always true because of "if" => why this test? - (isAnonymization ? "new-study-from-anonymization-job" : "new-study-from-modification-job"), - logData); - } + RecordAuditLog(userId, + jobResourceType, + modifiedResourceId, + // TODO: "isAnonymization" is always true because of "if" => why this test? + (isAnonymization ? "new-study-from-anonymization-job" : "new-study-from-modification-job"), + logData); } } } @@ -1280,7 +1277,9 @@ logData[KEY_PAYLOAD] = payload; // add UserData to the job payload to know who has modified the data. The handling of the log will then happen in the OnChange handler - SetUserIdInUserdata(logData, userId); + SetUserIdInUserdata(payload, userId); + std::string modifiedPayload = payload.toStyledString(); + coreApi.SetRequestBody(modifiedPayload); if (isModification) {