Bug 31857 - Drop-down list for objectclass and attributes
Drop-down list for objectclass and attributes
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM - Extended Attributes
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 4.4-8-errata
Assigned To: Philipp Hahn
Florian Best
:
: 33666 (view as bug list)
Depends on: 55670 20235
Blocks: 47273 53840
  Show dependency treegraph
 
Reported: 2013-06-28 18:04 CEST by Philipp Hahn
Modified: 2023-02-13 12:31 CET (History)
2 users (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Usability
Max CVSS v3 score:
hahn: Patch_Available+


Attachments
provide list of objectClasses and attributeTypes (53.18 KB, patch)
2015-06-18 12:43 CEST, Philipp Hahn
Details | Diff
patch (7.38 KB, patch)
2019-04-15 11:13 CEST, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2013-06-28 18:04:11 CEST
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.
Comment 1 Philipp Hahn univentionstaff 2014-09-25 18:31:45 CEST
Again: Ticket #2014092221000314: UCS Technikschulung

Also for required-/prohibited-objectClasses in UDM-policy objects.
Comment 2 Philipp Hahn univentionstaff 2015-06-18 12:43:42 CEST
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()
Comment 3 Florian Best univentionstaff 2016-06-21 12:14:59 CEST
*** Bug 33666 has been marked as a duplicate of this bug. ***
Comment 4 Florian Best univentionstaff 2016-09-24 15:10:46 CEST
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().
Comment 5 Florian Best univentionstaff 2019-04-15 11:13:49 CEST
Created attachment 9970 [details]
patch

Rebased patch.
Comment 6 Philipp Hahn univentionstaff 2021-01-22 17:31:13 CET
This is a pain in every UCS technical training 2021-01-21/22
Comment 8 Philipp Hahn univentionstaff 2021-01-25 10:11:46 CET
@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?
Comment 9 Florian Best univentionstaff 2021-01-25 13:39:50 CET
(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.
Comment 10 Philipp Hahn univentionstaff 2021-06-21 07:27:21 CEST
Another TT 2021-06-17/18
Comment 11 Philipp Hahn univentionstaff 2021-09-25 17:58:47 CEST
[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(+)
Comment 12 Florian Best univentionstaff 2021-09-27 08:21:29 CEST
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.
Comment 13 Florian Best univentionstaff 2021-09-27 09:40:46 CEST
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())]
Comment 15 Philipp Hahn univentionstaff 2021-09-27 17:22:25 CEST
(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
Comment 16 Florian Best univentionstaff 2021-09-29 13:27:43 CEST
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.
Comment 17 Florian Best univentionstaff 2021-09-29 15:53:20 CEST
OK: ucs-test