Mercurial > hg > orthanc
diff OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 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 | 59e3b6f8c5be |
children | 68e9f7815fb8 |
line wrap: on
line diff
--- 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; }