tldap.backend package

Submodules

tldap.backend.base module

This module provides the LDAP base functions with a subset of the functions from the real ldap module.

class tldap.backend.base.LdapBase(settings_dict: dict)[source]

Bases: object

The vase LDAP connection class.

add(dn: str, mod_list: dict) None[source]

Add a DN to the LDAP database; See ldap module. Doesn’t return a result if transactions enabled.

check_password(dn: str, password: str) bool[source]
close() None[source]
commit() None[source]

Attempt to commit all changes to LDAP database. i.e. forget all rollbacks. However stay inside transaction management.

delete(dn: str) None[source]

delete a dn in the ldap database; see ldap module. doesn’t return a result if transactions enabled.

enter_transaction_management() None[source]

Start a transaction.

is_dirty() bool[source]

Are there uncommitted changes?

is_managed() bool[source]

Are we inside transaction management?

leave_transaction_management() None[source]

End a transaction. Must not be dirty when doing so. ie. commit() or rollback() must be called if changes made. If dirty, changes will be discarded.

modify(dn: str, mod_list: dict) None[source]

Modify a DN in the LDAP database; See ldap module. Doesn’t return a result if transactions enabled.

modify_no_rollback(dn: str, mod_list: dict) None[source]

Modify a DN in the LDAP database; See ldap module. Doesn’t return a result if transactions enabled.

rename(dn: str, new_rdn: str, new_base_dn: str | None = None) None[source]

rename a dn in the ldap database; see ldap module. doesn’t return a result if transactions enabled.

reset(force_flush_cache: bool = False) None[source]

Reset transaction back to original state, discarding all uncompleted transactions.

rollback() None[source]

Roll back to previous database state. However stay inside transaction management.

search(base, scope, filterstr='(objectClass=*)', attrlist=None, limit=None) Generator[Tuple[str, dict], None, None][source]

Search for entries in LDAP database.

set_connection_class(connection_class)[source]

tldap.backend.fake_transactions module

This module provides the LDAP functions with transaction support faked, with a subset of the functions from the real ldap module.

class tldap.backend.fake_transactions.LDAPwrapper(settings_dict: dict)[source]

Bases: LdapBase

The LDAP connection class.

add(dn: str, mod_list: dict) None[source]

Add a DN to the LDAP database; See ldap module. Doesn’t return a result if transactions enabled.

commit() None[source]

Attempt to commit all changes to LDAP database. i.e. forget all rollbacks. However stay inside transaction management.

delete(dn: str) None[source]

delete a dn in the ldap database; see ldap module. doesn’t return a result if transactions enabled.

enter_transaction_management() None[source]

Start a transaction.

fail() None[source]

for testing purposes only. always fail in commit

is_dirty() bool[source]

Are there uncommitted changes?

is_managed() bool[source]

Are we inside transaction management?

leave_transaction_management() None[source]

End a transaction. Must not be dirty when doing so. ie. commit() or rollback() must be called if changes made. If dirty, changes will be discarded.

modify(dn: str, mod_list: dict) None[source]

Modify a DN in the LDAP database; See ldap module. Doesn’t return a result if transactions enabled.

modify_no_rollback(dn: str, mod_list: dict)[source]

Modify a DN in the LDAP database; See ldap module. Doesn’t return a result if transactions enabled.

rename(dn: str, new_rdn: str, new_base_dn: str | None = None) None[source]

rename a dn in the ldap database; see ldap module. doesn’t return a result if transactions enabled.

reset(force_flush_cache: bool = False) None[source]

Reset transaction back to original state, discarding all uncompleted transactions.

rollback() None[source]

Roll back to previous database state. However stay inside transaction management.

exception tldap.backend.fake_transactions.NoSuchObject[source]

Bases: Exception

tldap.backend.fake_transactions.raise_testfailure(place: str) None[source]

tldap.backend.no_transactions module

This module provides the LDAP functions with transaction support disabled, with a subset of the functions from the real ldap module.

class tldap.backend.no_transactions.LDAPwrapper(settings_dict: dict)[source]

Bases: LdapBase

The LDAP connection class.

add(dn: str, mod_list: dict) None[source]

Add a DN to the LDAP database; See ldap module. Doesn’t return a result if transactions enabled.

commit() None[source]

Attempt to commit all changes to LDAP database. i.e. forget all rollbacks. However stay inside transaction management.

delete(dn: str) None[source]

delete a dn in the ldap database; see ldap module. doesn’t return a result if transactions enabled.

enter_transaction_management() None[source]

Start a transaction.

is_dirty() bool[source]

Are there uncommitted changes?

is_managed() bool[source]

Are we inside transaction management?

leave_transaction_management() None[source]

End a transaction. Must not be dirty when doing so. ie. commit() or rollback() must be called if changes made. If dirty, changes will be discarded.

modify(dn: str, mod_list: dict) None[source]

Modify a DN in the LDAP database; See ldap module. Doesn’t return a result if transactions enabled.

modify_no_rollback(dn: str, mod_list: dict) None[source]

Modify a DN in the LDAP database; See ldap module. Doesn’t return a result if transactions enabled.

rename(dn: str, new_rdn: str, new_base_dn: str | None = None) None[source]

rename a dn in the ldap database; see ldap module. doesn’t return a result if transactions enabled.

reset(force_flush_cache: bool = False) None[source]

Reset transaction back to original state, discarding all uncompleted transactions.

rollback() None[source]

Roll back to previous database state. However stay inside transaction management.

Module contents

class tldap.backend.DefaultConnectionProxy[source]

Bases: object

Proxy for accessing the default DatabaseWrapper object’s attributes. If you need to access the DatabaseWrapper object itself, use connections[DEFAULT_LDAP_ALIAS] instead.

tldap.backend.connections = <tldap.utils.ConnectionHandler object>

An object containing a list of all LDAP connections.

tldap.backend.setup(settings)[source]

Function used to initialize LDAP settings.