Bug 52038 - ucschool.lib metaclass should find attributes in model mixin classes
ucschool.lib metaclass should find attributes in model mixin classes
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Ucsschool-lib
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v8
Assigned To: Daniel Tröder
Ole Schwiegert
http://forge.univention.org/bugzilla/...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-09-16 10:53 CEST by Daniel Tröder
Modified: 2020-11-18 10:38 CET (History)
0 users

See Also:
What kind of report is it?: Development Internal
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): Cleanup
Max CVSS v3 score:
troeder: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2020-09-16 10:53:35 CEST
When using mixin classes to extend the functionality of models in the ucsschool.lib, attributes (of type ucsschool.lib.models.attributes.Attribute) are ignored. Thus mixins classes can only contain methods but not the data they work on.
This has led to the RoleSupportMixin mixin class requiring all of its clients (the inheriting classes) to define the same attribute.
A new feature (Bug #52035) now wants to add a few attributes to selected classes, and again this cannot be done.

Modify the meta programming in the ucschool.lib to allow mixins to add attributes to model classes.
Comment 1 Daniel Tröder univentionstaff 2020-09-23 11:40:38 CEST
In git branch dtroeder/52038_allow_attributes_in_mixins the commit implements this:

21a334562 Bug #52038: look for Attribute and Meta objects in all base classes

Work has already been done (not yet commited) to cleanup the group changes for Bug #52035 and what's missing is to use this for base.RoleSupportMixin.
Comment 2 Daniel Tröder univentionstaff 2020-10-26 13:56:22 CET
The above commit has been merged (only change: improved a comment).
Additionally the email related work group attributes and the ucsschool_role attribute have been moved to separate mixin classes.

[4.4] fa7784129 Bug #52038: look for Attribute and Meta objects in all base classes
[4.4] 73b61f19b Bug #52038: move email related attributes to mixin class
[4.4] 5b87b689d Bug #52038: move 'ucsschool_roles' attribute to mixin class
[4.4] 3a12014cc Bug #52038: changelog and advisory
[4.4] 9635e7415 Bug #52038: advisory update

ucs-school-lib (12.2.1)
Comment 3 Ole Schwiegert univentionstaff 2020-10-27 10:51:36 CET
Changelog&Advisory: OK
Manual tests: OK
Automatic tests: NOT OK - The jenkins tests are broken at the moment, so I cannot VERIFY this bug until the tests are working again.
Comment 4 Ole Schwiegert univentionstaff 2020-10-29 08:33:14 CET
Though still not fixed the Jenkins tests ran the relevant tests for this bug and thus I can VERIFIY it.
Comment 5 Ole Schwiegert univentionstaff 2020-11-18 10:38:00 CET
UCS@school 4.4 v8 has been released (errata update to the release).

https://docs.software-univention.de/changelog-ucsschool-4.4v8-de.html

If this error occurs again, please clone this bug.