[python-ldap] multiples values in roleOccupant

Michael Ströder michael at stroeder.com
Mon Aug 1 18:42:54 CEST 2011


Francis Abrante wrote:
> 
> how do I for add multiples values in roleOccupant attribute?

In general it's an attribute value list.

>     old = {'roleOccupant':''}
>     new = {'roleOccupant':user}
>     ldif = modlist.modifyModlist(old,new)
>     l.modify_s(dn,ldif)

This won't work. Should be:

new = {'roleOccupant':[user]}

If you have large group entries you should build the modify list by hand.

Add two distinct users to the group entry:

user1 = 'uid=user1,dc=example,dc=com'
user2 = 'uid=user2,dc=example,dc=com'
modlist = [
  (ldap.MOD_ADD,'roleOccupant',[user1,user2]),
]

Ciao, Michael.


More information about the python-ldap mailing list