changeset 588:5cd0db97602b annotations

report additional information in /wsi/api/workspace-info
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 04 Sep 2026 18:13:14 +0200
parents b5fff3e9cb7c
children 3c95dbbc67a5 395d5ccd9ed1
files ViewerPlugin/Annotations/AnnotationsRestApi.cpp
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ViewerPlugin/Annotations/AnnotationsRestApi.cpp	Fri Sep 04 16:34:01 2026 +0200
+++ b/ViewerPlugin/Annotations/AnnotationsRestApi.cpp	Fri Sep 04 18:13:14 2026 +0200
@@ -92,6 +92,11 @@
       return *user_;
     }
 
+    ProjectRole GetRole() const
+    {
+      return role_;
+    }
+
     AnnotationsWorkspace& GetWorkspace()
     {
       assert(workspace_.get() != NULL);
@@ -154,11 +159,29 @@
 
       answer["name"] = context.GetWorkspace().GetProjectName();
       answer["description"] = context.GetWorkspace().GetProjectDescription();
+      answer["project"] = context.GetWorkspace().GetId().GetProjectId();
       answer["enabled"] = ViewerConfiguration::GetInstance().AreAnnotationsEnabled();
       answer["sharing"] = (ViewerConfiguration::GetInstance().AreAnnotationsEnabled() &&
                            ViewerConfiguration::GetInstance().IsAnnotationsSharingEnabled());
       answer["user"] = context.GetUser().Format();
 
+      std::string role;
+      switch (context.GetRole())
+      {
+        case ProjectRole_Learner:
+          role = "learner";
+          break;
+
+        case ProjectRole_Instructor:
+          role = "instructor";
+          break;
+
+        default:
+          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      }
+
+      answer["role"] = role;
+
 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 8)
       answer["persistent"] = true;
 #else