[python-ldap] ldap.modlist.modifyModlist

Joseph L. Casale jcasale at activenetwerx.com
Thu Nov 27 00:13:30 CET 2014


> Thanks for responding, and I appreciate the nudge in the right direction.  Unfortunately, I am new to both ldap and python, so I'm not quite sure where to go.  If it should be a delete, should it be similar to the form
>
>deleteDN = 'memberUid='+member1+',cn='+GRP+',ou=Group,dc=example,dc=com'
>
>l.delete_s(deleteDN)?
>
>If I'm asking too much, I apologize.

Nothing to apologize for,

You dont want to delete a dn, you want modify an object and
delete a single value for a given attribute type.

http://www.python-ldap.org/doc/html/ldap.html?highlight=modify#ldap.LDAPObject.modify_s

You know the dn (the group), now construct the modlist.

Use the modlist facility:
http://www.python-ldap.org/doc/html/ldap-modlist.html#module-ldap.modlist

maybe something like [(MOD_DELETE, 'memberUid', ['the_member_dn'])]

Just be aware in this case, if you pass do not specify a member, or list of
members, you drop the entire multivalued attribute type. Probably not
what you want...

jlc


More information about the python-ldap mailing list