# HG changeset patch # User Sebastien Jodogne # Date 1788528377 -7200 # Node ID 4e722446aca7235088e9c3ddded857129d6c7b62 # Parent 0b9af8de016f52499d3ea55a6c8ab8828ae43170 added configuration option "Instructors" diff -r 0b9af8de016f -r 4e722446aca7 NEWS --- a/NEWS Thu Sep 03 16:38:12 2026 +0200 +++ b/NEWS Fri Sep 04 15:26:17 2026 +0200 @@ -5,13 +5,20 @@ => Minimum SDK version: 1.7.0 <= * Support for annotations +* Persistence of annotations in the Orthanc database (SDK 1.12.8 is required) + +Configuration +------------- + * New configuration option "EnableAnnotations" to enable annotations * New configuration option "AuthenticationSource" to enable per-user annotations: - "None" uses the administrative Orthanc user (default) - "RegisteredUsers" relies on the HTTP basic authentication that is built in Orthanc - "HttpHeader" takes the user out of the HTTP header specified in "AuthenticationHttpHeader" option - "Plugin" can be used if the "orthanc-education" plugin is installed -* Persistence of annotations in the Orthanc database (SDK 1.12.8 is required) +* New configuration option "Instructors" to distinguish between learners + and instructors, only if the authentication source is "HttpHeader" +* New configuration option "EnableAnnotationsSharing" to enable sharing of annotations Maintenance ----------- diff -r 0b9af8de016f -r 4e722446aca7 ViewerPlugin/Annotations/IAuthenticatedUser.cpp --- a/ViewerPlugin/Annotations/IAuthenticatedUser.cpp Thu Sep 03 16:38:12 2026 +0200 +++ b/ViewerPlugin/Annotations/IAuthenticatedUser.cpp Fri Sep 04 15:26:17 2026 +0200 @@ -262,20 +262,13 @@ { return new GuestUser; } + else if (ViewerConfiguration::GetInstance().IsInstructor(user)) + { + return new GenericStandardUser(ProjectRole_Instructor, user); + } else { -#if 0 // TODO - TEST - if (user == "learner@uclouvain.be") - { - return new GenericStandardUser(ProjectRole_Learner, request->headersValues[i]); - } - else - { - return new GenericStandardUser(ProjectRole_Instructor, request->headersValues[i]); - } -#else - return new GenericStandardUser(ProjectRole_Instructor, request->headersValues[i]); -#endif + return new GenericStandardUser(ProjectRole_Learner, user); } } } diff -r 0b9af8de016f -r 4e722446aca7 ViewerPlugin/ViewerConfiguration.cpp --- a/ViewerPlugin/ViewerConfiguration.cpp Thu Sep 03 16:38:12 2026 +0200 +++ b/ViewerPlugin/ViewerConfiguration.cpp Fri Sep 04 15:26:17 2026 +0200 @@ -58,6 +58,11 @@ } Orthanc::Toolbox::ToLowerCase(authenticationHttpHeader_); + + if (!wsiConfiguration_.LookupSetOfStrings(instructors_, "Instructors", false)) + { + instructors_.clear(); + } } else if (value == "RegisteredUsers") { @@ -212,4 +217,17 @@ { return wsiConfiguration_.GetBooleanValue("EnableAnnotationsSharing", false); } + + + bool ViewerConfiguration::IsInstructor(const std::string& username) const + { + if (username.empty()) + { + return false; + } + else + { + return instructors_.find(username) != instructors_.end(); + } + } } diff -r 0b9af8de016f -r 4e722446aca7 ViewerPlugin/ViewerConfiguration.h --- a/ViewerPlugin/ViewerConfiguration.h Thu Sep 03 16:38:12 2026 +0200 +++ b/ViewerPlugin/ViewerConfiguration.h Fri Sep 04 15:26:17 2026 +0200 @@ -52,6 +52,7 @@ OrthancPlugins::OrthancConfiguration wsiConfiguration_; AuthenticationSource authenticationSource_; std::string authenticationHttpHeader_; + std::set instructors_; ViewerConfiguration(); @@ -84,5 +85,7 @@ unsigned int GetFeaturesCacheSize() const; bool IsAnnotationsSharingEnabled() const; + + bool IsInstructor(const std::string& username) const; }; }