FAQ | This is a LIVE service | Changelog

Skip to content

Resolve "Make use of the new givenName attribute from Lookup"

Robin Goodall requested to merge 14-use-given-name into master

Adds:

  • an extra --just-users command line option to skip group and institution (and their membership) checks - helpful for testing
  • show what an update has changed from for users - helps see what is being 'improved'
  • 'improved' naming

The naming follows this overview:

  1. If we've got a display name and it is different from cn (registered name) then we assume that this is what the user wants, so try splitting that to get given name and family name [1]
  2. If we've got both given name and surname from lookup then just use those directly to given name and family name in google
  3. If we've got a display name then try splitting that to get given name and family name [1]
  4. If we've got a cn then try splitting that to get given name and family name [1]
  5. Make do with want we have, probably ending up with just uid in both.

[1] Splitting a fullname to given_name and family_name (possibly helped by surname and lookup's given name):

  1. If we have a surname and fullname ends with it, then chop surname off the end to get given name
  2. If surname has hyphens in it, do the same as above but comparing a version of surname with hyphens swapped for spaces [2]
  3. If we have a given name and fullname starts with it, then chop this off the front to get surname [3]
  4. We fallback to just split off the surname as after the last space (if that gives us a given name too)

[2] Found several of these which was causing degredation in parsing, e.g.

"Stephen Quill Roman" with sn of "Quill-Roman" was ending up as "Stephen Quill", "Roman" (falling through to using last space)

Now (correctly) becomes "Stephen", "Quill Roman" (assumes that user's display name with spaces not hyphen is desired)

[3] An additional wrinkle here is to move any left over initials to the given name from what would end up as family name, e.g.

Without this step: "Stephen Q. Roman" with given_name of "Stephen" would end up as "Stephen", "Q. Roman". This step moves these to get "Stephen Q.", "Roman"

All this ends up with (currently):

INFO:gsuitesync.sync:Number of existing users to update: 604

Closes #14 (closed)

Merge request reports