Univention Bugzilla – Bug 57068
Add a proper (sub)syntax for UDM_PropertySelect
Last modified: 2024-02-19 13:16:04 CET
For blocklist blockingProperties we use the complex syntax UDM_PropertySelect, currently with "string". Better to have a correct sub syntax for modules and properties. Florian's Idea: class UDM_PropertySelect(complex): """Syntax to enter |UDM| module and property name.""" subsyntaxes = ((_('UDM module'), univentionAdminModules), (_('property'), allModuleProperties)) subsyntax_names = ('module', 'property') class allModuleProperties(combobox): """Syntax to select properties for |UDM| modules.""" depends = 'module' @classmethod def update_choices(cls): cls.choices = cls.get_choices(None, {'dependencies': {cls.depends: list(univention.admin.modules.modules)}}) @classmethod def get_choices(cls, lo, options): if cls.depends not in options.get('dependencies', {}): # pragma: no cover return cls.choices modules = options['dependencies'][cls.depends] return cls.sort_choices([ (key, opt.short_description) for module in modules for key, opt in getattr(univention.admin.modules.get(module), 'property_descriptions', {}).items() ])
That sketch probably doesn't work yet, as it specifies "module" as dependency while "module" is not a property but a sub-syntax. Therefore the "depends" should be the name of the property. Then the given dependency is probably given as list [module, property]. and we have to take the first entry there to get the selected module and choose the available properties for it. I don't know if the javascript frontend already supports dependencies for sub-syntaxes (i.e. detect to reload values when the value of the same property changes).