s.Ldb(_Ldb) : class documentation

Part of samba View In Hierarchy

Known subclasses: samba.idmap.IDmapDB, samba.samdb.SamDB

Simple Samba-specific LDB subclass that takes care of setting up the modules dir, credentials pointers, etc.

Please note that this is intended to be for all Samba LDB files, not necessarily the Sam database. For Sam-specific helper functions see samdb.py.

Method __init__ Opens a Samba Ldb file.
Method searchone Search for one attribute as a string.
Method erase_users_computers Erases user and computer objects from our AD.
Method erase_except_schema_controlled Erase this ldb.
Method erase Erase this ldb, removing all records.
Method load_ldif_file_add Load a LDIF file.
Method add_ldif Add data based on a LDIF string.
Method modify_ldif Modify database based on a LDIF string.
def __init__(self, url=None, lp=None, modules_dir=None, session_info=None, credentials=None, flags=0, options=None):
Opens a Samba Ldb file.

This is different from a regular Ldb file in that the Samba-specific modules-dir is used by default and that credentials and session_info can be passed through (required by some modules).

ParametersurlOptional LDB URL to open
lpOptional loadparm object
modules_dirOptional modules directory
session_infoOptional session information
credentialsOptional credentials, defaults to anonymous.
flagsOptional LDB flags
optionsAdditional options (optional)
def searchone(self, attribute, basedn=None, expression=None, scope=ldb.SCOPE_BASE):
Search for one attribute as a string.
ParametersbasednBaseDN for the search.
attributeName of the attribute
expressionOptional search expression.
scopeSearch scope (defaults to base).
ReturnsValue of attribute as a string or None if it wasn't found.
def erase_users_computers(self, dn):
Erases user and computer objects from our AD.

This is needed since the 'samldb' module denies the deletion of primary groups. Therefore all groups shouldn't be primary somewhere anymore.

def erase_except_schema_controlled(self):
Erase this ldb.
NoteRemoves all records, except those that are controlled by Samba4's schema.
def erase(self):
Erase this ldb, removing all records.
def load_ldif_file_add(self, ldif_path):
Load a LDIF file.
Parametersldif_pathPath to LDIF file.
def add_ldif(self, ldif, controls=None):
Add data based on a LDIF string.
ParametersldifLDIF text.
def modify_ldif(self, ldif, controls=None):
Modify database based on a LDIF string.
ParametersldifLDIF text.
API Documentation for Samba, generated by pydoctor at 2011-12-08 20:23:28.