changeset 580:be0aa2c9d0b1 annotations

creating learners
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 03 Sep 2026 14:49:29 +0200
parents 2556d9fd27c6
children 921f79004d81
files ViewerPlugin/Annotations/IAuthenticatedUser.cpp
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ViewerPlugin/Annotations/IAuthenticatedUser.cpp	Thu Sep 03 14:29:13 2026 +0200
+++ b/ViewerPlugin/Annotations/IAuthenticatedUser.cpp	Thu Sep 03 14:49:29 2026 +0200
@@ -83,7 +83,7 @@
     };
 
 
-    class EducationPluginAuthenticatedUser : public IAuthenticatedUser
+    class EducationPluginUser : public IAuthenticatedUser
     {
     public:
       enum EducationRole
@@ -100,7 +100,7 @@
       std::set<std::string>  learnerOfProjects_;
 
     public:
-      explicit EducationPluginAuthenticatedUser(const Json::Value& authentication)
+      explicit EducationPluginUser(const Json::Value& authentication)
       {
         assert(Orthanc::SerializationToolbox::ReadString(authentication, "source") == "orthanc-education");
 
@@ -184,13 +184,16 @@
     };
 
 
-    class GenericInstructor : public IAuthenticatedUser
+    class GenericStandardUser : public IAuthenticatedUser
     {
     private:
+      ProjectRole  role_;
       std::string  username_;
 
     public:
-      explicit GenericInstructor(const std::string& username) :
+      GenericStandardUser(ProjectRole role,
+                          const std::string& username) :
+        role_(role),
         username_(username)
       {
       }
@@ -207,7 +210,7 @@
 
       virtual ProjectRole GetRoleInProject(const std::string& projectId) const ORTHANC_OVERRIDE
       {
-        return ProjectRole_Instructor;
+        return role_;
       }
     };
   }
@@ -234,7 +237,8 @@
           if (!tokens.empty() &&
               !tokens[0].empty())
           {
-            return new GenericInstructor(tokens[0]);
+            //return new GenericStandardUser(IAuthenticatedUser::ProjectRole_Instructor, tokens[0]);
+            return new GenericStandardUser(IAuthenticatedUser::ProjectRole_Learner, tokens[0]);
           }
         }
       }
@@ -261,7 +265,7 @@
         }
         else
         {
-          return new GenericInstructor(request->headersValues[i]);
+          return new GenericStandardUser(IAuthenticatedUser::ProjectRole_Instructor, request->headersValues[i]);
         }
       }
     }
@@ -293,7 +297,7 @@
 
         if (source == "orthanc-education")
         {
-          return new EducationPluginAuthenticatedUser(authentication);
+          return new EducationPluginUser(authentication);
         }
         else
         {