-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdto.py
More file actions
71 lines (52 loc) · 1.45 KB
/
dto.py
File metadata and controls
71 lines (52 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""ldap schema DTO.
Copyright (c) 2025 MultiFactor
License: https://github.com/MultiDirectoryLab/MultiDirectory/blob/main/LICENSE
"""
from dataclasses import dataclass, field
from typing import Generic, TypeVar
from enums import EntityTypeNames, KindType
_IdT = TypeVar("_IdT", int, None)
@dataclass
class AttributeTypeDTO(Generic[_IdT]):
"""Attribute Type DTO."""
oid: str
name: str
ldap_display_name: str
syntax: str
single_value: bool
no_user_modification: bool
is_system: bool
system_flags: int
is_included_anr: bool
id: _IdT = None # type: ignore
object_class_names: set[str] = field(default_factory=set)
_LinkT = TypeVar("_LinkT", AttributeTypeDTO, str)
@dataclass
class ObjectClassDTO(Generic[_IdT, _LinkT]):
"""Object Class DTO."""
oid: str
name: str
superior_name: str | None
kind: KindType
is_system: bool
attribute_types_must: list[_LinkT]
attribute_types_may: list[_LinkT]
id: _IdT = None # type: ignore
entity_type_names: set[str] = field(default_factory=set)
@dataclass
class EntityTypeDTO(Generic[_IdT]):
"""Entity Type DTO."""
name: EntityTypeNames | str
is_system: bool
object_class_names: list[str]
id: _IdT = None # type: ignore
@dataclass
class AttributeDTO:
name: str
values: list[str]
@dataclass
class CreateDirDTO:
name: str
entity_type_name: EntityTypeNames
attributes: tuple[AttributeDTO, ...]
is_system: bool