Mercurial > hg > orthanc
changeset 5446:912565317b9a
plugins are now allowed to modify/delete private metadata/attachments
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 24 Nov 2023 12:12:03 +0100 |
parents | b853a63e9830 |
children | dacdce5e5c22 |
files | NEWS OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp |
diffstat | 2 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Fri Nov 24 11:53:23 2023 +0100 +++ b/NEWS Fri Nov 24 12:12:03 2023 +0100 @@ -50,6 +50,13 @@ - added 'orthanc_storage_cache_count' and 'orthanc_storage_cache_size_mb' +Plugins +------- + +* Plugins are now allowed to modify/delete private metadata/attachments + (i.e. whose identifiers are < 1024) + + Maintenance -----------
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Fri Nov 24 11:53:23 2023 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Fri Nov 24 12:12:03 2023 +0100 @@ -1912,7 +1912,8 @@ std::string name = call.GetUriComponent("name", ""); MetadataType metadata = StringToMetadata(name); - if (IsUserMetadata(metadata)) // It is forbidden to modify internal metadata + if (IsUserMetadata(metadata) || // It is forbidden to delete internal metadata... + call.GetRequestOrigin() == RequestOrigin_Plugins) // ...except for plugins { bool found; int64_t revision; @@ -1978,7 +1979,8 @@ std::string value; call.BodyToString(value); - if (IsUserMetadata(metadata)) // It is forbidden to modify internal metadata + if (IsUserMetadata(metadata) || // It is forbidden to modify internal metadata... + call.GetRequestOrigin() == RequestOrigin_Plugins) // ...except for plugins { int64_t oldRevision; std::string oldMD5; @@ -2574,7 +2576,8 @@ std::string name = call.GetUriComponent("name", ""); FileContentType contentType = StringToContentType(name); - if (IsUserContentType(contentType)) // It is forbidden to modify internal attachments + if (IsUserContentType(contentType) || // It is forbidden to modify internal attachments... + call.GetRequestOrigin() == RequestOrigin_Plugins) // ...except for plugins { int64_t oldRevision; std::string oldMD5; @@ -2633,7 +2636,8 @@ FileContentType contentType = StringToContentType(name); bool allowed; - if (IsUserContentType(contentType)) + if (IsUserContentType(contentType) || // It is forbidden to delete internal attachments... + call.GetRequestOrigin() == RequestOrigin_Plugins) // ...except for plugins { allowed = true; }