Mercurial > hg > orthanc-wsi
changeset 583:4e722446aca7 annotations
added configuration option "Instructors"
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Fri, 04 Sep 2026 15:26:17 +0200 |
| parents | 0b9af8de016f |
| children | 0b45bebe7926 |
| files | NEWS ViewerPlugin/Annotations/IAuthenticatedUser.cpp ViewerPlugin/ViewerConfiguration.cpp ViewerPlugin/ViewerConfiguration.h |
| diffstat | 4 files changed, 34 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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 -----------
--- 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); } } }
--- 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(); + } + } }
--- 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<std::string> instructors_; ViewerConfiguration(); @@ -84,5 +85,7 @@ unsigned int GetFeaturesCacheSize() const; bool IsAnnotationsSharingEnabled() const; + + bool IsInstructor(const std::string& username) const; }; }
