From f4b08a0bb6960bddfd1006ceac506a0a61c2a49f Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Sun, 2 Nov 2025 20:05:54 +0100
Subject: [PATCH] protected system - new users to be disabled by default
---
modules/interfaces/interfaceDbAppObjects.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/modules/interfaces/interfaceDbAppObjects.py b/modules/interfaces/interfaceDbAppObjects.py
index 938fe756..18fb34bf 100644
--- a/modules/interfaces/interfaceDbAppObjects.py
+++ b/modules/interfaces/interfaceDbAppObjects.py
@@ -493,7 +493,7 @@ class AppObjects:
logger.error(f"Unexpected error creating user: {str(e)}")
raise ValueError(f"Failed to create user: {str(e)}")
- def updateUser(self, userId: str, updateData: Dict[str, Any]) -> User:
+ def updateUser(self, userId: str, updateData: Union[Dict[str, Any], User]) -> User:
"""Update a user's information"""
try:
# Get user
@@ -501,9 +501,20 @@ class AppObjects:
if not user:
raise ValueError(f"User {userId} not found")
+ # Convert updateData to dict if it's a User model
+ if isinstance(updateData, User):
+ updateDict = updateData.model_dump()
+ else:
+ updateDict = updateData.copy() if isinstance(updateData, dict) else updateData
+
+ # Remove id field from updateDict if present - we'll use userId from parameter
+ updateDict.pop("id", None)
+
# Update user data using model
updatedData = user.model_dump()
- updatedData.update(updateData)
+ updatedData.update(updateDict)
+ # Ensure ID matches userId parameter
+ updatedData["id"] = userId
updatedUser = User(**updatedData)
# Update user record