Univention Bugzilla – Bug 31857
Drop-down list for objectclass and attributes
Last modified: 2023-02-13 12:31:43 CET
Ticket#: 2013052421000972 ] UCS Technikschulung If would be nice if the UDM module for Extended Attributes would provide a list of available objectClasses and LDAP attributes. univention-ldapsearch -xLLLb 'cn=Subschema' -s base objectClasses | ldapsearch-wrapper | sed -rne "s/^objectClasses: \( [0-9.]+ NAME ('[^']+'|\(( '[^']+')+ \)) .*/\1/p" ... univention-ldapsearch -xLLLb 'cn=Subschema' -s base attributeTypes | ldapsearch-wrapper | sed -rne "s/^attributeTypes: \( [0-9.]+ NAME ('[^']+'|\(( '[^']+')+ \)) .*/\1/p" ... PS: This might be problematic for existing buggy join scripts providing new schemata, since slapd and udm-cli then must be restarted before udm settings/extended_attribute accepts the new objectClass / LDAP-attribute as valid.
Again: Ticket #2014092221000314: UCS Technikschulung Also for required-/prohibited-objectClasses in UDM-policy objects.
Created attachment 6969 [details] provide list of objectClasses and attributeTypes univention-management-console-module-udm is missing a call of univention.admin.syntax.update_choices()
*** Bug 33666 has been marked as a duplicate of this bug. ***
Would be nice and also not hard to implement. The available patch can be enhanced by using the new univention.admin.uldap.access.get_scheme().
Created attachment 9970 [details] patch Rebased patch.
This is a pain in every UCS technical training 2021-01-21/22
See https://git.knut.univention.de/univention/ucs/-/tree/phahn/udm-ea
@fbest: Your patch contains the following hunk: > univention-management-console-module-udm/umc/python/udm/__init__.py > 164 class Instance(Base, ProgressMixin): > 173 »···def init(self): > + udm_syntax.update_choices() I did not pick that hunk into my branch, but still seems to work; I have not yet run ucs-test. Contrary I was able to remove many other such duplicate calls. Why is it needed and for what?
(In reply to Philipp Hahn from comment #8) > @fbest: Your patch contains the following hunk: > > univention-management-console-module-udm/umc/python/udm/__init__.py > > 164 class Instance(Base, ProgressMixin): > > 173 »···def init(self): > > + udm_syntax.update_choices() > > I did not pick that hunk into my branch, but still seems to work; I have not > yet run ucs-test. > Contrary I was able to remove many other such duplicate calls. > Why is it needed and for what? This was for the initial loading of syntax choices. It was otherwise not loaded in the UMC module and only contains the initial values. But since git:7805602400aff13bdf0d377c4bcdde9b47a1e362 Bug #30387 or git:754fdef7f74f82bd5aa8f1df88090ee1ec252e8e Bug #48621 this is already done in modules.update() and modules.init(). So the hunk is not required anymore.
Another TT 2021-06-17/18
[4.4-8] b66e1b75e8 doc[udm/syntax] More PEP-484 type annotations .../univention-directory-manager-modules/modules/univention/admin/syntax.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) [4.4-8] a03e7ace25 fix[udm/syntax] Remove broken delimiters management/univention-directory-manager-modules/modules/univention/admin/syntax.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) [4.4-8] 65ae202870 style[udm/syntax] Make choices a list of tuple .../modules/univention/admin/syntax.py | 43 ++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 13 deletions(-) [4.4-8] 84be8ab7d1 style[udm/syntax] Convert to list comprehension .../modules/univention/admin/syntax.py | 39 +++++++++++------------------ 1 file changed, 14 insertions(+), 25 deletions(-) [4.4-8] 2a7baa7291 fix[udm/syntax] Explicit return None management/univention-directory-manager-modules/modules/univention/admin/syntax.py | 2 ++ 1 file changed, 2 insertions(+) [4.4-8] a1ef5b810e refactor[udm/syntax] Move up new() and any() .../modules/univention/admin/syntax.py | 55 ++++++++++++++--------------- 1 file changed, 27 insertions(+), 28 deletions(-) [4.4-8] 5d7457924a style[udm/syntax] all_required: bool management/univention-directory-manager-modules/modules/univention/admin/syntax.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) [4.4-8] 55338f300a style[udm]: Move Country.update_choices() management/univention-directory-manager-modules/modules/univention/admin/syntax.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) [4.4-8] ff3ee056eb fix[udm]: Remove explicit Country.update_choices() management/univention-directory-manager-modules/modules/univention/admin/syntax.py | 1 - 1 file changed, 1 deletion(-) [4.4-8] 639d1d6d2e Bug #31857 UDM: Remove explicit syntax.update_choices() management/univention-directory-manager-modules/modules/univention/admincli/adduser.py | 3 --- management/univention-management-console-module-ipchange/umc/python/ipchange/__init__.py | 3 --- services/univention-ad-connector/modules/univention/connector/__init__.py | 3 --- services/univention-s4-connector/modules/univention/s4connector/__init__.py | 3 --- 4 files changed, 12 deletions(-) [4.4-8] 3f51b498a3 Bug #31857 UDM: Cleanup univentionAdminModules_update .../modules/univention/admin/syntax.py | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) [4.4-8] 1e7786b768 Bug #31857 UDM: Make LDAP Object Class and Attribute names selectable .../univention-directory-manager-modules/debian/changelog | 1 + .../modules/univention/admin/syntax.py | 50 +++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 7 deletions(-) [4.4-8] 7cbea3ce94 Bug #31857 UDM: Switch to syntax classes for LDAP schema .../modules/univention/admin/handlers/settings/extended_attribute.py | 4 ++-- .../modules/univention/admin/handlers/settings/extended_options.py | 2 +- management/univention-directory-manager-modules/modules/univention/admin/policy.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) [4.4-8] de7c789c55 fixup! Bug #49235 udm: Drop default property identifies=False|0 management/univention-directory-manager-modules/modules/univention/admin/policy.py | 5 ----- 1 file changed, 5 deletions(-) [4.4-8] a2f547ea7a fixup! Bug #49235 udm: Drop default property may_change=True|1 management/univention-directory-manager-modules/modules/univention/admin/policy.py | 5 ----- 1 file changed, 5 deletions(-) Package: univention-directory-manager-modules Version: 14.0.20-19A~4.4.0.202109251745 Branch: ucs_4.4-0 Scope: errata4.4-8 [4.4-8] f06bb46853 Bug #52683: univention-directory-manager-modules 14.0.20-19A~4.4.0.202109251745 doc/errata/staging/univention-directory-manager-modules.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Note/Warning: Previously: # systemctl stop slapd.service # time python -c 'import univention.admin.modules; univention.admin.modules.update()' real 0m0,488s user 0m0,395s sys 0m0,085s Now with the changes applied: # systemctl stop slapd.service # time python -c 'import univention.admin.modules; univention.admin.modules.update()' real 0m30,579s user 0m0,456s sys 0m0,080s → It takes 30 seconds to do a python import if the slapd does not run.
We should add empty values to the new dropdown - so that by default no invalid objectClass-attribute is selected. diff --git management/univention-directory-manager-modules/modules/univention/admin/syntax.py management/univention-directory-manager-modules/modules/univention/admin/syntax.py index 5af5038086..ef5fd2ca9c 100644 --- management/univention-directory-manager-modules/modules/univention/admin/syntax.py +++ management/univention-directory-manager-modules/modules/univention/admin/syntax.py @@ -2635,6 +2635,8 @@ class ldapObjectClass(combobox): """ choices = [('top', 'top')] + empty_value = True + @classmethod def fill_choices(cls, ocs): # type: (Iterable[str]) -> None cls.choices = [(oc, oc) for oc in sorted(ocs, key=lambda oc: oc.lower())] @@ -2646,6 +2648,8 @@ class ldapAttribute(combobox): """ choices = [] # type: Sequence[Tuple[str, str]] + empty_value = True + @classmethod def fill_choices(cls, attrs): # type: (Iterable[str]) -> None cls.choices = [(attr, attr) for attr in sorted(attrs, key=lambda oc: oc.lower())]
I suspect the following test to fail due to git:ff3ee056eb3f2c9770d0c5fe1f0362cc5e9c53d3, etc.? https://jenkins.knut.univention.de:8181/job/UCS-4.4/job/UCS-4.4-8/job/AutotestUpgrade/lastCompletedBuild/SambaVersion=s4,Systemrolle=master/testReport/61_udm-users/27_country_names_uptodate/master071/ https://jenkins.knut.univention.de:8181/job/UCS-4.4/job/UCS-4.4-8/job/AutotestUpgrade/lastCompletedBuild/SambaVersion=s4,Systemrolle=master/testReport/61_udm-users/22_execute_udm_users_list_as_administrator/master071/
(In reply to Florian Best from comment #13) > We should add empty values to the new dropdown - so that by default no > invalid objectClass-attribute is selected. ... > + empty_value = True Applied: [4.4-8] 5f892f35b7 fix[udm/syntax] Start with empty selection management/univention-directory-manager-modules/debian/changelog | 6 ++++++ management/univention-directory-manager-modules/modules/univention/admin/syntax.py | 3 +++ 2 files changed, 9 insertions(+) (In reply to Florian Best from comment #12) > → It takes 30 seconds to do a python import if the slapd does not run. Fixed: [4.4-8] 010b680cef perf[udm/syntax] Make LDAP Object Class and Attribute names selectable .../modules/univention/admin/syntax.py | 86 +++++++++++++++++------------ 1 file changed, 51 insertions(+), 35 deletions(-) Package: univention-directory-manager-modules Version: 14.0.20-21A~4.4.0.202109271552 Branch: ucs_4.4-0 Scope: errata4.4-8 (In reply to Florian Best from comment #14) > I suspect the following test to fail due to > git:ff3ee056eb3f2c9770d0c5fe1f0362cc5e9c53d3, etc.? > > 61_udm-users/27_country_names_uptodate/master071/ Fixed: [4.4-8] c7ea17814d fix[test/udm/user]: Update countries test/ucs-test/debian/changelog | 6 ++++++ test/ucs-test/tests/61_udm-users/27_country_names_uptodate | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) > 61_udm-users/22_execute_udm_users_list_as_administrator/master071/ Looks unrelated to my changes and work's in my test VM. Package: ucs-test Version: 9.0.7-70A~4.4.0.202109271554 Branch: ucs_4.4-0 Scope: errata4.4-8 [4.4-8] 7599193edc Bug #52683: univention-directory-manager-modules 14.0.20-21A~4.4.0.202109271552 doc/errata/staging/univention-directory-manager-modules.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) QA: Waiting for ucs-test
OK: selection of objectClass, attributes OK: empty values OK: import fast+possible if slapd is down OK: test cases OK: YAML Missing: Jenkins result from tomorrow?! Otherwise VERIFIED.
OK: ucs-test
<https://errata.software-univention.de/#/?erratum=4.4x1058>