Sort order of users (while adding to a group)

When adding a user to a group, the list of users available to be added
is sorted by “Name” but apparently presented as “Realname”. That results
in a confusingly non-sorted list if - as in our situation - users’
“Name” is their login name which might not match the name they use, e.g.
login name “ab1” (from “Anthony Bloggs”) but the Realname is “Tony
Bloggs” will be sorted amongst the names beginning with “A”.

Here’s a patch to Admin/Elements/SelectNewGroupMembers which achieves
sorting by Realname. If there’s no Realname set then the Name shows
instead.

— /opt/rt3/share/html/Admin/Elements/SelectNewGroupMembers 2009-02-03 11:53:01.000000000 +0000
+++ /opt/rt3/local/plugins/RTx-Sanger-SortUsersByRealname/html/Admin/Elements/SelectNewGroupMembers 2009-03-25 14:52:25.000000000 +0000
@@ -84,6 +84,7 @@
ENTRYAGGREGATOR => ‘AND’
);
$users->LimitToPrivileged();
+$users->OrderBy( FIELD => $UserOrderBy, ORDER => $UserOrder );

my $groups = new RT::Groups($session{‘CurrentUser’});

@@ -99,4 +100,6 @@
$Group
$SkipUsers => {}
$SkipGroups => {}
+$UserOrderBy => ‘RealName’
+$UserOrder => ‘ASC’
</%ARGS>

Cheers,
Dave
** Dave Holland ** Systems Support – Infrastructure Management **
** 01223 496923 ** The Sanger Institute, Hinxton, Cambridge, UK **
“You’re out of your mind.” “Yeah. Ain’t it cool?”

The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

When adding a user to a group, the list of users available to be added
is sorted by “Name” but apparently presented as “Realname”. That results
in a confusingly non-sorted list if - as in our situation - users’
“Name” is their login name which might not match the name they use, e.g.
login name “ab1” (from “Anthony Bloggs”) but the Realname is “Tony
Bloggs” will be sorted amongst the names beginning with “A”.

Here’s a patch to Admin/Elements/SelectNewGroupMembers which achieves
sorting by Realname. If there’s no Realname set then the Name shows
instead.

It’s worth noting that display of names is a per-user config. It
probably makes more sense to key off that.