KevinHorvatin / google-apps-for-your-domain-ldap-sync

Automatically exported from code.google.com/p/google-apps-for-your-domain-ldap-sync
0 stars 0 forks source link

Implement default behavior to handle multivalued LDAP attributes #14

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Similar to issue #13.

Multivalued LDAP attributes are lists and most of the code which handles
LDAP attributes assumes single string values.

Most applications choose the first value as default if multivalued which is
reasonable behavior.

Example, a multivalued SN creates this issue on update:
Traceback (most recent call last):
  File "./sync_ldap.py", line 183, in ?
    (config, ldap_context, user_database, google_context, log_config)
= \
  File "./sync_ldap.py", line 112, in DoMain
    cmd.cmdloop()
  File "/usr/lib/python2.4/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.4/cmd.py", line 219, in onecmd
    return func(arg)
  File "/root/temp/google-apps-for-your-domain-ldap-sync/commands.py",
line 293, in do_updateUsers
    attrlist=attrs)
  File "/root/temp/google-apps-for-your-domain-ldap-sync/
ldap_ctxt.py", line 257, in Search
    return self.AsyncSearch(filter_arg, sizelimit, attrlist=attrlist)
  File "/root/temp/google-apps-for-your-domain-ldap-sync/
ldap_ctxt.py", line 239, in AsyncSearch
    return userdb.UserDB(config=self._config, users=users)
  File "/root/temp/google-apps-for-your-domain-ldap-sync/userdb.py",
line 304, in __init__
    self._AddUsers(users)
  File "/root/temp/google-apps-for-your-domain-ldap-sync/userdb.py",
line 1196, in _AddUsers
    self.db[dn] = self._MapUser(attrs)
  File "/root/temp/google-apps-for-your-domain-ldap-sync/userdb.py",
line 1260, in _MapUser
    if ldap_user_xform.MeetsPrereqs(attrs):
  File "/root/temp/google-apps-for-your-domain-ldap-sync/
user_transformation_rule.py", line 83, in MeetsPrereqs
    self.Mapping(ldap)
  File "/root/temp/google-apps-for-your-domain-ldap-sync/
user_transformation_rule.py", line 187, in Mapping
    mappings['%sCallback' % attr] = self._TransformAttr(attr, attrs)
  File "/root/temp/google-apps-for-your-domain-ldap-sync/
user_transformation_rule.py", line 162, in _TransformAttr
    r = eval('self.%s(attrs)' % callback_name)
  File "<string>", line 0, in ?
  File "/root/temp/google-apps-for-your-domain-ldap-sync/
user_transformation_rule.py", line 116, in GoogleFirstName
    return NameSplit(ldap['givenName'], ldap['sn'],
ldap['displayName'])[0]
  File "/root/temp/google-apps-for-your-domain-ldap-sync/
user_transformation_rule.py", line 56, in NameSplit
    surname_pieces = surname.split()
AttributeError: 'list' object has no attribute 'split' 

Original issue reported on code.google.com by david.c....@gmail.com on 17 Jul 2008 at 7:42