changeset 513:e26bf161c039 annotations

added class IAuthenticatedUser::GenericInstructor
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 21 Aug 2026 15:28:23 +0200
parents 971c7c1ca617
children eefdef0a313e
files ViewerPlugin/Annotations/IAuthenticatedUser.cpp
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ViewerPlugin/Annotations/IAuthenticatedUser.cpp	Wed Aug 19 15:25:12 2026 +0200
+++ b/ViewerPlugin/Annotations/IAuthenticatedUser.cpp	Fri Aug 21 15:28:23 2026 +0200
@@ -177,6 +177,34 @@
       }
     }
   };
+
+
+  class GenericInstructor : public IAuthenticatedUser
+  {
+  private:
+    std::string  username_;
+
+  public:
+    GenericInstructor(const std::string& username) :
+      username_(username)
+    {
+    }
+
+    virtual UserId GetAnnotatingId() const ORTHANC_OVERRIDE
+    {
+      return UserId(UserId::Type_Standard, username_);
+    }
+
+    virtual std::string Format() const ORTHANC_OVERRIDE
+    {
+      return username_;
+    }
+
+    virtual ProjectRole GetRoleInProject(const std::string& projectId) const ORTHANC_OVERRIDE
+    {
+      return ProjectRole_Instructor;
+    }
+  };
 }
 
 
@@ -206,6 +234,12 @@
       {
         return new EducationPluginAuthenticatedUser(authentication);
       }
+#if 0
+      else if (source == "orthanc-python-sample-authentication")
+      {
+        return new GenericInstructor(Orthanc::SerializationToolbox::ReadString(authentication, "username"));
+      }
+#endif
     }
 
     return new GuestUser;