user.sync

Attributes

_T

Classes

UserSourceArgsWithoutName

dict() -> new empty dictionary

UserSource

Generalized UserSource to facilitate ldap sync

ZugUserSource

Generalized UserSource to facilitate ldap sync

Module Contents

class user.sync.UserSourceArgsWithoutName[source]

Bases: TypedDict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

bases: collections.abc.Sequence[str][source]
org: NotRequired[Any][source]
filters: NotRequired[collections.abc.Sequence[str]][source]
user_type: NotRequired[str][source]
default_filter: NotRequired[str][source]
user.sync._T[source]
class user.sync.UserSource(name: str, bases: Sequence[str], org: Any | None = None, filters: Sequence[str] | None = None, user_type: str | None = None, default_filter: str = '(objectClass=*)', verbose: bool = False)[source]

Generalized UserSource to facilitate ldap sync

name[source]
_bases[source]
default_filter = '(objectClass=*)'[source]
filters[source]
_org = None[source]
_user_type = None[source]
verbose = False[source]
static scalar(value: list[str] | str | None, default: str = '') str[source]
static scalar(value: list[_T] | _T | None, default: _T) _T
property ldap_attributes: Sequence[str][source]
Abstractmethod:

property ldap_mapping: Mapping[str, str][source]
Abstractmethod:

property organisation: Any[source]
property bases: Sequence[str][source]
user_type_default(entry: ldap3.Entry) str | None[source]
user_type(entry: ldap3.Entry) str | None[source]
excluded_default(entry: ldap3.Entry) bool[source]

Default when no function specific to the source name exists.

excluded(entry: ldap3.Entry) bool[source]

Finds a specific exclusion function specific to the name or use the fallback

property default_filters: list[str][source]
property bases_filters_attributes: Sequence[tuple[str, str, Sequence[str]]][source]
map_entry(entry: ldap3.Entry) dict[str, Any][source]
complete_entry(user: dict[str, Any], **kwargs: Any) dict[str, Any][source]

Add additional logic after the user is mapped before writing to the db.

map_entries(entries: Iterable[Entry], **kwargs: Any) Iterator[dict[str, Any]][source]
class user.sync.ZugUserSource(name: str, bases: Sequence[str], org: Any | None = None, filters: Sequence[str] | None = None, user_type: str | None = None, default_filter: str = '(objectClass=*)', verbose: bool = False)[source]

Bases: UserSource

Generalized UserSource to facilitate ldap sync

default_filter = '(objectClass=*)'[source]
ldap_mapping[source]
schools: dict[str, UserSourceArgsWithoutName][source]
ldap_users: dict[str, UserSourceArgsWithoutName][source]
property ldap_attributes: list[str][source]
user_type_ktzg(entry: ldap3.Entry) str | None[source]

KTZG specific user type

user_type_default(entry: ldap3.Entry) str | None[source]

For all the schools, we filter by Mail already, but we exclude the students. Name specific user_type functions will run first, this is a fallback.

excluded(entry: ldap3.Entry) bool[source]

General exclusion pattern for all synced users.

map_entry(entry: ldap3.Entry) dict[str, Any][source]
complete_entry(user: dict[str, Any], **kwargs: Any) dict[str, Any][source]

Add additional logic after the user is mapped before writing to the db.

map_entries(entries: Iterable[Entry], **kwargs: Any) Iterator[dict[str, Any]][source]
classmethod factory(verbose: bool = False) list[ZugUserSource][source]