web2ldap  1.7.7
About: web2ldap is a full-featured web-based LDAPv3 client.
  Fossies Dox: web2ldap-1.7.7.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ucs.py
Go to the documentation of this file.
1# -*- coding: ascii -*-
2"""
3web2ldap plugin classes for Univention Corporate Server
4"""
5
6import bz2
7import re
8
9from ..schema.syntaxes import (
10 Binary,
11 RFC822Address,
12 DirectoryString,
13 DistinguishedName,
14 DynamicDNSelectList,
15 PreformattedMultilineText,
16 XmlValue,
17 syntax_registry,
18)
19from .msperson import DateOfBirth
20
21
23 oid: str = 'UniventionObjectType-oid'
24 desc: str = 'Type of UCS object'
25 pattern = re.compile('^[a-z_]+/[a-z_]+$')
26
27syntax_registry.reg_at(
28 UniventionObjectType.oid, [
29 '1.3.6.1.4.1.10176.1003.1', # univentionObjectType
30 ]
31)
32
33
35 oid: str = 'UniventionPolicyReference-oid'
36 desc: str = 'DN of referenced univentionPolicy entry'
37 ldap_url = 'ldap:///_?cn?sub?(objectClass=univentionPolicy)'
38
39syntax_registry.reg_at(
40 UniventionPolicyReference.oid, [
41 '1.3.6.1.4.1.10176.1000', # univentionPolicyReference
42 ]
43)
44
45
47 oid: str = 'EntryDNUniventionPolicy-oid'
48 desc: str = 'entryDN of an univentionPolicy entry'
49 ref_attrs = (
50 (
51 'univentionPolicyReference', 'Used by', None,
52 'Search all entries referencing this policy.'
53 ),
54 )
55
56syntax_registry.reg_at(
57 EntryDNUniventionPolicy.oid, [
58 '1.3.6.1.1.20', # entryDN
59 '1.3.6.1.4.1.4203.666.1.33', # entryDN (legacy)
60 ],
61 structural_oc_oids=[
62 '1.3.6.1.4.1.10176.1000.2.2.1', # univentionPolicy
63 '1.3.6.1.4.1.10176.1000.308.2.1', # umcPolicy
64 ],
65)
66
67
68syntax_registry.reg_at(
69 DateOfBirth.oid, [
70 '1.3.6.1.4.1.10176.99', # univentionBirthday
71 ]
72)
73
74
75syntax_registry.reg_at(
76 RFC822Address.oid, [
77 '1.3.6.1.4.1.10176.1010.1.1', # mailPrimaryAddress
78 '1.3.6.1.4.1.10176.1010.1.100', # univentionMailMember
79 ]
80)
81
82
83syntax_registry.reg_at(
84 DistinguishedName.oid, [
85 '1.3.6.1.4.1.10176.500.1.5', # univentionDnsForwardZone
86 '1.3.6.1.4.1.10176.500.1.6', # univentionDnsReverseZone
87 '1.3.6.1.4.1.10176.1000.11.1.2', # univentionNetworkLink
88 '1.3.6.1.4.1.10176.4200.4.2', # enabledServiceProviderIdentifierGroup
89 '1.3.6.1.4.1.10176.1000.308.1.1', # umcPolicyGrantedOperationSet
90 ]
91)
92
93
94syntax_registry.reg_at(
95 XmlValue.oid, [
96 '1.3.6.1.4.1.10176.4200.1.14', # serviceProviderMetadata
97 ]
98)
99
100
102 oid: str = 'UniventionLDAPACLData-oid'
103 desc: str = 'bzip2-ed LDAP ACL data in Univention'
104
105 def sanitize(self, attr_value: bytes) -> bytes:
106 return bz2.compress(PreformattedMultilineText.sanitize(self, attr_value))
107
108 def form_value(self) -> str:
109 splitted_lines = [
110 self._app.ls.uc_decode(line_b)[0]
111 for line_b in self._split_lines_split_lines(bz2.decompress(self._av) or b'')
112 ]
113 return '\r\n'.join(splitted_lines)
114
115 def validate(self, attr_value: bytes):
116 Binary.validate(self, bz2.decompress(attr_value))
117
118 def _split_lines(self, value):
119 return bz2.decompress(self._av).split(b'\n')
120
121 def display(self, vidx, links) -> str:
122 return PreformattedMultilineText.display(self, vidx, links)
123
124syntax_registry.reg_at(
125 UniventionLDAPACLData.oid, [
126 '1.3.6.1.4.1.10176.4202.1.22', # univentionLDAPACLData
127 ]
128)
129
130
131# Register all syntax classes in this module
132syntax_registry.reg_syntaxes(__name__)
bytes sanitize(self, bytes attr_value)
Definition: ucs.py:105
def validate(self, bytes attr_value)
Definition: ucs.py:115