Merge pull request #62 from valueonag/int

fix user list
This commit is contained in:
ValueOn AG 2025-11-07 09:38:11 +01:00 committed by GitHub
commit 91ac1680cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -304,17 +304,22 @@ class AppObjects:
"""
Returns users for a specific mandate if user has access.
Supports optional pagination, sorting, and filtering.
For SYSADMIN, returns all users regardless of mandate.
Args:
mandateId: The mandate ID to get users for
mandateId: The mandate ID to get users for (ignored for SYSADMIN)
pagination: Optional pagination parameters. If None, returns all items.
Returns:
If pagination is None: List[User]
If pagination is provided: PaginatedResult with items and metadata
"""
# Get users for this mandate
users = self.db.getRecordset(UserInDB, recordFilter={"mandateId": mandateId})
# For SYSADMIN, get all users regardless of mandate
# For others, filter by mandate
if self.currentUser and self.currentUser.privilege == UserPrivilege.SYSADMIN:
users = self.db.getRecordset(UserInDB)
else:
users = self.db.getRecordset(UserInDB, recordFilter={"mandateId": mandateId})
filteredUsers = self._uam(UserInDB, users)
# If no pagination requested, return all items