fix user list
This commit is contained in:
parent
88110d0f9d
commit
c3b334c250
1 changed files with 8 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue