commit
91ac1680cb
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.
|
Returns users for a specific mandate if user has access.
|
||||||
Supports optional pagination, sorting, and filtering.
|
Supports optional pagination, sorting, and filtering.
|
||||||
|
For SYSADMIN, returns all users regardless of mandate.
|
||||||
|
|
||||||
Args:
|
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.
|
pagination: Optional pagination parameters. If None, returns all items.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
If pagination is None: List[User]
|
If pagination is None: List[User]
|
||||||
If pagination is provided: PaginatedResult with items and metadata
|
If pagination is provided: PaginatedResult with items and metadata
|
||||||
"""
|
"""
|
||||||
# Get users for this mandate
|
# For SYSADMIN, get all users regardless of mandate
|
||||||
users = self.db.getRecordset(UserInDB, recordFilter={"mandateId": mandateId})
|
# 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)
|
filteredUsers = self._uam(UserInDB, users)
|
||||||
|
|
||||||
# If no pagination requested, return all items
|
# If no pagination requested, return all items
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue