Univention Bugzilla – Attachment 9766 Details for
Bug 43129
Enhance UDM Syntax for Generalized Time Syntax
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
example-hook.py
bug43129.py (text/plain), 1.42 KB, created by
Sönke Schwardt-Krummrich
on 2018-12-03 15:10:12 CET
(
hide
)
Description:
example-hook.py
Filename:
MIME Type:
Creator:
Sönke Schwardt-Krummrich
Created:
2018-12-03 15:10:12 CET
Size:
1.42 KB
patch
obsolete
>import univention.admin >import univention.admin.modules >import univention.admin.hook >import univention.admin.handlers.users.user >import univention.testing.utils > >def mydebug(msg): > univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, '40_extended_attribute_attributehook_value_mapping: MySampleHook: %s' % (msg,)) > >mydebug('TEST MODULE LOADED') > >class MySampleHook(univention.admin.hook.AttributeHook): > ldap_attribute_name = 'univentionFreeAttribute3' > udm_attribute_name = 'myTestUDMProperty' > > def map_attribute_value_to_ldap(self, value): > mydebug('map_attribute_value_to_ldap(%r)' % (value,)) > if value == 'FALSE': > return 'no' > elif value == 'TRUE': > return 'yes' > elif value in ('', None): > return '' > else: > # this is not great, but works reasonably well > mydebug('map_attribute_value_to_ldap(%r) ==> found invalid value' % (value,)) > raise univention.admin.uexceptions.valueError('%s: Value may not be %r' % (self.ldap_attribute_name, value)) > > def map_attribute_value_to_udm(self, value): > mydebug('map_attribute_value_to_udm(%r)' % (value,)) > if value == 'yes': > return 'TRUE' > elif value == 'no': > return 'FALSE' > elif value in ('', None): > return '' > else: > # this is not great, but works reasonably well > mydebug('map_attribute_value_to_udm(%r) ==> found invalid value' % (value,)) > raise univention.admin.uexceptions.valueError('%s: Value may not be %r' % (self.udm_attribute_name, value))
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 43129
:
9243
|
9244
|
9245
|
9246
|
9722
| 9766