Univention Bugzilla – Bug 54690
[Kelvin API] ucsschool.lib drops one OU when adding and removing a school to/from a user at the same time
Last modified: 2022-04-27 16:41:48 CEST
When a user has 2 OUs and in a modify operation one is removed and another is added, the additional OU is later missing in the "schools" attribute: -------------------------------------------------------------------------------- user = Student(name="stud9", school="DEMOSCHOOL", schools=["DEMOSCHOOL", "school1"], firstname='James9', lastname='Bond9', school_classes={'DEMOSCHOOL': ['ds'], 'school1': ['s1']}) user.create(lo) user.schools = ["DEMOSCHOOL", "school2"] user.school_classes={'DEMOSCHOOL': ['ds'], 'school2': ['s2']} user.modify(lo) print("school={!r} schools={!r} school_classes={!r}".format(user.school, user.schools, user.school_classes)) → school=u'DEMOSCHOOL' schools=[u'DEMOSCHOOL'] school_classes={'school2': ['s2'], 'DEMOSCHOOL': ['ds']} --------------------------- validation ----------------------------------------- ... UCS@school Object ... with options {...} has validation errors: - is not part of schools: ['school2']. -------------------------------------------------------------------------------- Fix the ucsschool.lib in to contain all OUs in the "schools" attribute. This bug is for UCS@school 4.4. Split this bug into additional bugs for 5.0 and Kelvin.
The "schools" attribute is now correctly set, after removing a user from a school. [feature/kelvin] c44563569 Bug #54690: fix removing and adding school in one go [feature/kelvin] 0761cc43f Bug #54690: changelog
OK: code review A few tests for adding and removing OUs from/to a user have been added: [feature/kelvin] 4bcf677cb Bug #54690: add tests for adding and removing schools OK: Both the tests for the ucsschool.lib and Kelvin now succeed. A new Docker image for version 1.5.4 was built: ff6213b99e5d Waiting for results from the Jenkins job.
OK The tests in the Jenkins job succeeded. Especially interesting: 94_ucsschool-api-kelvin/10_in_container_tests_kelvin_api → tests/test_route_user.py::test_change_school_ 94_ucsschool-api-kelvin/10_in_container_tests_ucsschool_lib → ucsschool/lib/tests/test_user.py::test_modify_{add,remove}*_school One _unrelated_ test failed. It was fixed: [feature/kelvin] 90cc12212 Bug #54690: fix test: email domain must exist in ucs domain A new Docker image for version 1.5.4 was built: f3ef9be32dfb
The Kelvin REST API version 1.5.4 has been released. https://appcenter.software-univention.de/univention-repository/4.4/maintained/component/ucsschool-kelvin-rest-api_20220322152801/README_UPDATE_DE If this error occurs again, please clone this bug.