ldap3.abstract.objectDef module

class ldap3.abstract.objectDef.ObjectDef(object_class=None, schema=None, custom_validator=None)

Bases: object

Represent an object in the LDAP server. AttrDefs are stored in a dictionary; the key is the friendly name defined in AttrDef.

AttrDefs can be added and removed using the += ad -= operators

ObjectDef can be accessed either as a sequence and a dictionary. When accessed the whole AttrDef instance is returned

add_attribute(definition=None)

Add an AttrDef to the ObjectDef. Can be called with the += operator. :param definition: the AttrDef object to add, can also be a string containing the name of attribute to add. Can be a list of both

add_from_schema(attribute_name, mandatory=False)
clear_attributes()

Empty the ObjectDef attribute list

remove_attribute(item)

Remove an AttrDef from the ObjectDef. Can be called with the -= operator. :param item: the AttrDef to remove, can also be a string containing the name of attribute to remove