Lines 2383-2404
def parse(self, text):
|
Link Here
|
---|
|
2383 |
raise univention.admin.uexceptions.valueError(_("Not a valid LDAP DN")) |
2383 |
raise univention.admin.uexceptions.valueError(_("Not a valid LDAP DN")) |
2384 |
|
2384 |
|
2385 |
|
2385 |
|
2386 |
class ldapObjectClass(simple): |
2386 |
class ldapObjectClass(combobox): |
2387 |
""" |
2387 |
""" |
2388 |
Syntax to enter a |LDAP| objectClass name. |
2388 |
Syntax to enter a |LDAP| objectClass name. |
2389 |
""" |
2389 |
""" |
2390 |
@classmethod |
2390 |
choices = (('top', 'top')) |
2391 |
def parse(self, text): |
|
|
2392 |
return text |
2393 |
|
2391 |
|
2394 |
|
2392 |
|
2395 |
class ldapAttribute(simple): |
2393 |
class ldapAttribute(combobox): |
2396 |
""" |
2394 |
""" |
2397 |
Syntax to enter a |LDAP| attribute name. |
2395 |
Syntax to enter a |LDAP| attribute name. |
2398 |
""" |
2396 |
""" |
2399 |
@classmethod |
2397 |
|
2400 |
def parse(self, text): |
2398 |
|
2401 |
return text |
2399 |
def _update_schema(): |
|
|
2400 |
from univention.uldap import getMachineConnection |
2401 |
from ldap.schema import ObjectClass, AttributeType |
2402 |
try: |
2403 |
conn = getMachineConnection() |
2404 |
subschema = conn.get_schema() |
2405 |
|
2406 |
ocs = set() |
2407 |
for oid in subschema.listall(ObjectClass): |
2408 |
oc = subschema.get_obj(ObjectClass, oid) |
2409 |
if oc: |
2410 |
ocs |= set(oc.names) |
2411 |
ldapObjectClass.choices = [(_oc, _oc) for _oc in sorted(ocs, key=lambda s: s.lower())] |
2412 |
|
2413 |
attrs = set() |
2414 |
for oid in subschema.listall(AttributeType): |
2415 |
attr = subschema.get_obj(AttributeType, oid) |
2416 |
if attr: |
2417 |
attrs |= set(attr.names) |
2418 |
ldapAttribute.choices = [(_attr, _attr) for _attr in sorted(attrs, key=lambda s: s.lower())] |
2419 |
except ldap.SERVER_DOWN: |
2420 |
pass |
2421 |
finally: |
2422 |
try: |
2423 |
conn.unbind() |
2424 |
except: |
2425 |
pass |
2426 |
|
2427 |
|
2428 |
__register_choice_update_function(_update_schema) |
2402 |
|
2429 |
|
2403 |
|
2430 |
|
2404 |
class ldapFilter(simple): |
2431 |
class ldapFilter(simple): |
Lines 4051-4074
def parse(self, text):
|
Link Here
|
---|
|
4051 |
return text |
4078 |
return text |
4052 |
raise univention.admin.uexceptions.valueInvalidSyntax(_('"%s" is not a Univention Admin Module.') % text) |
4079 |
raise univention.admin.uexceptions.valueInvalidSyntax(_('"%s" is not a Univention Admin Module.') % text) |
4053 |
|
4080 |
|
4054 |
# Unfortunately, Python doesn't seem to support (static) class methods; |
4081 |
@classmethod |
4055 |
# however, (static) class variables such as "choices" seem to work; |
4082 |
def update_choices(cls): |
4056 |
# so, we'll modify "choices" using this global method |
4083 |
""" |
4057 |
|
4084 |
Update internal list of |UDM| modules in :py:class:`univentionAdminModules`. |
4058 |
|
4085 |
""" |
4059 |
def univentionAdminModules_update(): |
4086 |
cls.choices = sorted([ |
4060 |
""" |
4087 |
(name, univention.admin.modules.short_description(mod)) |
4061 |
Update internal list of |UDM| modules in :py:class:`univentionAdminModules`. |
4088 |
for name, mod in univention.admin.modules.modules.items() |
4062 |
""" |
4089 |
if not univention.admin.modules.virtual(mod) |
4063 |
temp = [] |
4090 |
], key=operator.itemgetter(1)) |
4064 |
for name, mod in univention.admin.modules.modules.items(): |
|
|
4065 |
if not univention.admin.modules.virtual(mod): |
4066 |
temp.append((name, univention.admin.modules.short_description(mod))) |
4067 |
|
4068 |
univentionAdminModules.choices = sorted(temp, key=operator.itemgetter(1)) |
4069 |
|
4091 |
|
4070 |
|
4092 |
|
4071 |
__register_choice_update_function(univentionAdminModules_update) |
4093 |
__register_choice_update_function(univentionAdminModules.update_choices) |
4072 |
|
4094 |
|
4073 |
|
4095 |
|
4074 |
class UDM_PropertySelect(complex): |
4096 |
class UDM_PropertySelect(complex): |