tldap.database package¶
Submodules¶
tldap.database.helpers module¶
Various helper functions to aid applications processing schema specific functions.
- tldap.database.helpers.add_group_member(changes: Changeset, member: LdapObject) Changeset [source]¶
- tldap.database.helpers.load_account(python_data: LdapObject, group_table: Type[LdapObject]) LdapObject [source]¶
- tldap.database.helpers.load_group(python_data: LdapObject, account_table: Type[LdapObject]) LdapObject [source]¶
- tldap.database.helpers.load_password_object(python_data: LdapObject) LdapObject [source]¶
- tldap.database.helpers.load_person(python_data: LdapObject, group_table: Type[LdapObject]) LdapObject [source]¶
- tldap.database.helpers.load_pwdpolicy(python_data: LdapObject) LdapObject [source]¶
- tldap.database.helpers.load_shadow(python_data: LdapObject) LdapObject [source]¶
- tldap.database.helpers.load_shibboleth(python_data: LdapObject) LdapObject [source]¶
- tldap.database.helpers.rdn_to_dn(changes: Changeset, name: str, base_dn: str) Changeset [source]¶
Convert the rdn to a fully qualified DN for the specified LDAP connection.
- Parameters:
changes – The changes object to lookup.
name – rdn to convert.
base_dn – The base_dn to lookup.
- Returns:
fully qualified DN.
- tldap.database.helpers.remove_group_member(changes: Changeset, member: LdapObject) Changeset [source]¶
- tldap.database.helpers.save_account(changes: Changeset, database: Database, format_fields: Set[str] | None = None) Changeset [source]¶
Module contents¶
High level database interaction.
- class tldap.database.Changeset(fields: Dict[str, Field], src: LdapObject, d: dict | None = None)[source]¶
Bases:
ImmutableDict
Represents a set of changes to an LdapObject.
- property changes: Dict[str, List[Tuple[MODIFY_ADD, List[Any]]]]¶
- property errors: List[str]¶
- property is_valid: bool¶
- property src: LdapObject¶
- class tldap.database.Database(connection: LdapBase, settings: dict | None = None)[source]¶
Bases:
object
- property settings: dict¶
- class tldap.database.LdapObject(d: dict | None = None)[source]¶
Bases:
ImmutableDict
A high level python representation of a LDAP object.
- classmethod get_search_options(database: Database) SearchOptions [source]¶
- classmethod on_load(python_data: LdapObject, database: Database) LdapObject [source]¶
- class tldap.database.NotLoaded[source]¶
Bases:
object
Base class to represent a related field that has not been loaded.
- load(database: Database | None = None) LdapObject [source]¶
- class tldap.database.NotLoadedList(*, table: Type[LdapObject], key: str, value: str)[source]¶
Bases:
NotLoaded
Represents a list of objects that needs to be loaded via a single key.
- load(database: Database | None = None) List[LdapObject] [source]¶
- class tldap.database.NotLoadedObject(*, table: Type[LdapObject], key: str, value: str)[source]¶
Bases:
NotLoaded
Represents a single object that needs to be loaded.
- load(database: Database | None = None) LdapObject [source]¶
- class tldap.database.SearchOptions(base_dn: str, object_class: Set[str], pk_field: str)[source]¶
Bases:
object
Application specific search options.
- tldap.database.changeset(python_data: LdapObject, d: dict) Changeset [source]¶
Generate changes object for ldap object.
- tldap.database.delete(python_data: LdapObject, database: Database | None = None) None [source]¶
Delete a LdapObject from the database.
- tldap.database.get_one(table: Type[LdapObject], query: Q | None = None, database: Database | None = None, base_dn: str | None = None) LdapObject [source]¶
Get exactly one result from the database or fail.
- tldap.database.insert(python_data: LdapObject, database: Database | None = None) LdapObject [source]¶
Insert a new python_data object in the database.
- tldap.database.preload(python_data: LdapObject, database: Database | None = None) LdapObject [source]¶
Preload all NotLoaded fields in LdapObject.
- tldap.database.rename(python_data: LdapObject, new_base_dn: str | None = None, database: Database | None = None, **kwargs) LdapObject [source]¶
Move/rename a LdapObject in the database.
- tldap.database.save(changes: Changeset, database: Database | None = None) LdapObject [source]¶
Save all changes in a LdapChanges.
- tldap.database.search(table: Type[LdapObject], query: Q | None = None, database: Database | None = None, base_dn: str | None = None) Iterator[LdapObject] [source]¶
Search for a object of given type in the database.