From c30ca547528007b7b5df6c38bf38dcccca93d42b Mon Sep 17 00:00:00 2001 From: Jonathan Leung Date: Thu, 13 Oct 2022 14:58:50 -0400 Subject: [PATCH] Sort group member listing by WatIAM ID (#78) Closes #74. Co-authored-by: Jono Reviewed-on: https://git.csclub.uwaterloo.ca/public/pyceo/pulls/78 Reviewed-by: Raymond Li Co-authored-by: Jonathan Leung Co-committed-by: Jonathan Leung --- ceod/model/LDAPService.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ceod/model/LDAPService.py b/ceod/model/LDAPService.py index a569991..7ec6388 100644 --- a/ceod/model/LDAPService.py +++ b/ceod/model/LDAPService.py @@ -112,14 +112,14 @@ class LDAPService: filter = '(|' + ''.join([f'(uid={uid})' for uid in usernames]) + ')' attributes = ['uid', 'cn', 'program'] conn.search(self.ldap_users_base, filter, attributes=attributes) - return [ + return sorted([ { 'uid': entry.uid.value, 'cn': entry.cn.value, 'program': entry.program.value or 'Unknown', } for entry in conn.entries - ] + ], key=lambda member: member['uid']) def get_users_with_positions(self) -> List[IUser]: conn = self._get_ldap_conn()