From 65a802649615f8a5b051a6e9ec8a85a2ddf76aee Mon Sep 17 00:00:00 2001
From: patrick-motsch
Date: Sat, 28 Feb 2026 15:53:31 +0100
Subject: [PATCH] fix: load system bot credentials only when joinMode is
SYSTEM_BOT (anonymous join fix)
Made-with: Cursor
---
modules/features/teamsbot/routeFeatureTeamsbot.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/features/teamsbot/routeFeatureTeamsbot.py b/modules/features/teamsbot/routeFeatureTeamsbot.py
index a764eb64..7388bff1 100644
--- a/modules/features/teamsbot/routeFeatureTeamsbot.py
+++ b/modules/features/teamsbot/routeFeatureTeamsbot.py
@@ -202,9 +202,9 @@ async def startSession(
botAccountPassword = None
# System bot access: only SysAdmin can use the system bot account.
- # Non-SysAdmin users are forced to anonymous join to prevent concurrent
- # access conflicts (a Microsoft account can only be in one meeting at a time).
- if context.isSysAdmin:
+ # Credentials are loaded only when joinMode explicitly requests SYSTEM_BOT.
+ # When joinMode is ANONYMOUS, the bot joins without auth regardless of SysAdmin.
+ if context.isSysAdmin and joinMode == TeamsbotJoinMode.SYSTEM_BOT:
systemBot = interface.getActiveSystemBot(mandateId)
if not systemBot:
from .datamodelTeamsbot import TeamsbotSystemBot