From fe27f51ebb38e0517644313afc101054fc41c208 Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Tue, 27 May 2025 14:32:08 +0200
Subject: [PATCH] base for module testing
---
modules/routes/routeSecurityLocal.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules/routes/routeSecurityLocal.py b/modules/routes/routeSecurityLocal.py
index 608528d8..6d2ffd73 100644
--- a/modules/routes/routeSecurityLocal.py
+++ b/modules/routes/routeSecurityLocal.py
@@ -121,12 +121,20 @@ async def register_user(userData: User):
# Get gateway interface
appInterface = getInterface()
- # Create user
+ # Get default mandate ID
+ defaultMandateId = appInterface.getInitialId("mandates")
+ if not defaultMandateId:
+ raise HTTPException(
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
+ detail="No default mandate found"
+ )
+
+ # Create user with default mandate
user = appInterface.createUser(
username=userData.username,
password=userData.password,
email=userData.email,
- mandateId=userData.mandateId,
+ mandateId=defaultMandateId, # Use default mandate instead of userData.mandateId
authenticationAuthority=AuthAuthority.LOCAL
)