40 lines
1,016 B
Python
40 lines
1,016 B
Python
from enum import Enum
|
|
from typing import Protocol, List, Tuple, Dict, Optional
|
|
|
|
class Scope(Enum):
|
|
BASE = "base"
|
|
ONELEVEL = "onelevel"
|
|
SUBTREE = "subtree"
|
|
|
|
SCOPE_BASE = Scope.BASE
|
|
SCOPE_ONELEVEL = Scope.ONELEVEL
|
|
SCOPE_SUBTREE = Scope.SUBTREE
|
|
|
|
class Mod(Enum):
|
|
ADD = "add"
|
|
DELETE = "delete"
|
|
REPLACE = "replace"
|
|
|
|
MOD_ADD = Mod.ADD
|
|
MOD_DELETE = Mod.DELETE
|
|
MOD_REPLACE = Mod.REPLACE
|
|
|
|
ModEntry = Tuple[Mod, str, bytes | List[bytes]]
|
|
|
|
class LDAPError(Exception): ...
|
|
class NO_SUCH_OBJECT(LDAPError): ...
|
|
|
|
class ldapobject(Protocol):
|
|
def start_tls_s(self) -> None: ...
|
|
def simple_bind_s(self, dn: str, password: str) -> None: ...
|
|
def search_s(
|
|
self,
|
|
base: str,
|
|
scope: Scope,
|
|
filterstr: str = "(objectClass=*)",
|
|
attrlist: Optional[List[str]] = None,
|
|
attrsonly: int = 0,
|
|
) -> List[Tuple[str, Dict[str, List[bytes]]]]: ...
|
|
def modify_s(self, dn: str, modlist: List[ModEntry]) -> None: ...
|
|
|
|
def initialize(url: str) -> ldapobject: ...
|