CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-ldap3

tessl install tessl/pypi-ldap3@1.4.0

A strictly RFC 4510 conforming LDAP V3 pure Python client library

Agent Success

Agent success rate when using this tile

81%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.08x

Baseline

Agent success rate without this tile

75%

task.mdevals/scenario-5/

Directory People Helper

Build a schema-aware helper that relies on a directory abstraction layer to search and update person entries using simplified queries rather than raw LDAP operations.

Capabilities

Schema mapping for people entries

  • Creating the schema maps directory attributes to friendly keys, validates that email values contain @, and applies a default department when none is present. @test

Simplified search with dereferencing

  • Running a search with query string name: Alice* & department: Engineering under the base DN returns entries as dictionaries sorted by name, including DN, friendly fields, manager common name via DN dereference, and created timestamps normalized to ISO 8601 strings. @test

Paged retrieval

  • When page_size is set to 1, the search walks multiple result pages automatically and aggregates them while keeping the same ordering. @test

Safe updates and rename

  • Updating an entry's department and renaming its relative DN commits changes and refreshes cached data so follow-up searches reflect the new department and DN. @test

Implementation

@generates

API

from typing import Any, Dict, List, Optional

class DirectoryClient:
    def __init__(self, connection: Any, base_dn: str):
        """
        Create a directory client bound to a base DN using an existing connection.
        The client should rely on the high-level abstraction layer for schema-aware access.
        """

    def bootstrap_people_schema(self) -> None:
        """
        Define and cache the object/attribute model for person entries.
        Maps raw directory attributes to friendly keys: dn, name, email, department,
        manager (resolved to common name), and created_at (ISO string).
        Applies default department when missing and validates that email values contain '@'.
        """

    def find_people(self, query: str, include_operational: bool = False,
                    page_size: Optional[int] = None) -> List[Dict[str, Any]]:
        """
        Search under the base DN using simplified query syntax (e.g., 'name: Alice* & department: Engineering').
        Returns dictionaries ordered by name with keys dn, name, email, department, manager, created_at.
        If include_operational is True, include operational timestamp data; omit when False.
        When page_size is provided, iterate through all result pages automatically and merge them.
        """

    def update_department(self, entry_dn: str, department: str) -> bool:
        """
        Update the department for the entry identified by entry_dn using the abstraction layer's write support.
        Commits the change immediately and clears any pending operations.
        Returns True when the server acknowledges the update.
        """

    def rename_person(self, entry_dn: str, new_rdn: str) -> bool:
        """
        Rename the entry's relative distinguished name and refresh its data.
        Returns True when the rename succeeds and follow-up reads surface the new DN.
        """

Dependencies { .dependencies }

ldap3 { .dependency }

High-level LDAP client with schema-aware abstraction and simplified query language. @satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/ldap3@1.4.x
tile.json