Univention Bugzilla – Bug 45749
[4.3] model resource to make available import permissions / roles readable
Last modified: 2018-07-04 18:08:49 CEST
In Bug #45717 the available roles for an import are retrieved in the Python client library. That was enough for a client that should run on the dc master. But the information should really be available through the HTTP API. Make the roles available for an import readable through the HTTP API.
The roles of the connecting user can now be retrieved through the HTTP-API. The read-only Role resource is available at: 1. https://$FQDN/api/v1/roles/ 2. https://$FQDN/api/v1/school/$OU/roles/ In 1. all roles of all schools are listed. This is necessary for the role resources to have a common URL. In 2. only the roles a user has at that school are listed. A test for retrieving roles through the Python client API was added (301_http-api_pyclient_roles). Let's use "3??_http-api_*" for tests regarding the HTTP-API based import. [4.3] 59bc68c5 Bug #45749: add Role model [4.3] 0b751ae4 Bug #45749: add Role serializer and view [4.3] de097432 Bug #45749: don't open LDAP connection at import time [4.3] 2e9ee5a3 Bug #45749: support school='*' in query [4.3] 8303ecdc Bug #45749: minor improvements [4.3] d5aa34f9 Bug #45749: Python client lib uses new Role resource [4.3] 3b7d84fa Bug #45749: changelog [4.3] ef791329 Bug #45749: add support for Role resource [4.3] 19ce710a Bug #45749: changelog [4.3] c9482a12 Bug #45749: split non-cli-import code into separate (base) class [4.3] 5bf8fc59 Bug #45749: add test for HTTP-API Python client [4.3] d0ab8f49 Bug #45749: changelog [4.3] a0e53e6a Bug #45749: advisories ucs-school-import (16.0.2-1) ucs-school-umc-import (1.0.1-2) ucs-test-ucsschool (5.0.2-55)
You are using the terms "Mitarbeiterinnen und Mitarbeiter" and "Lehrkräfte und Mitarbeiter*innen". I see, that "Lehrkräfte, Mitarbeiter und Mitarbeiterinnen" might be too long, but the GUI should be consistent when using terms. Always use "Mitarbeiter*innen"? See also https://git.knut.univention.de/univention/ucsschool/commit/c9482a126 OK: code change OK: functional change OK: manual test against https://$FQDN/api/v1/roles/ OK: manual test against https://$FQDN/api/v1/schools/$OU/roles/ OK: changelog entry OK: advisory OK: package built and installable REOPEN: tests 301_http-api_* is not tested but skipped in jenkins. Presumably because the http-api packages are not installed within the jenkins environment. REOPEN: manual call of the test script fails Traceback (most recent call last): File "301_http-api_pyclient_roles", line 80, in <module> Test().run() File "/usr/share/ucs-test/90_ucsschool/essential/importusers_cli_v2.py", line 283, in run self.test() File "301_http-api_pyclient_roles", line 69, in test roles_from_api = client.school.get(ou.name).roles File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 483, in get return self._to_python(self._get_resource(pk)) File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 467, in _get_resource return self._resource_from_url(url, **params) File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 463, in _resource_from_url return self.client.call_api('get', url, params=params) File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 444, in call_api raise exc(msg, status_code=response.status_code) ucsschool.http_api.client.ObjectNotFound: Received status_code=404 with reason='Not Found' for requests.get(**files=None, url=u'https://master110.nstx.local/api/v1/schools/5zcwhw4uw/', auth=('a9uciei83a', u'**********'), headers={u'Accept': u'application/json'}, params={}, data=None).
[4.3] 04c68e54 Bug #45749: use HTTP-API test class, also check schools ucs-test-ucsschool (5.0.2-56)
[4.3-0 e957f80a50] Bug #45749: install HTTP-API import backend and frontend for jenkins test
The above error shouldn't happen, because the list of OUs is updated each time the school resource is listed, and when retrieving a specific OU, it is updated as well. Nonetheless I have added a ou_post_create hook, that does this automatically whenever a school-OU is created. Please retest. [4.3] bd160417 Bug #45749: create Django School object after ucsschool.lib school creation [4.3] b6301e56 Bug #45749: changelog [4.3] b6129a18 Bug #45749: advisory ucs-school-import (16.0.2-9)
OK: code change OK: functional change (not the ideal solution, but we haven't found the cause of this issue; at least this fix/workaround can be easily replaced later on with a real fix) OK: manual test against https://$FQDN/api/v1/roles/ OK: manual test against https://$FQDN/api/v1/schools/$OU/roles/ OK: advisory OK: package built and installable
The hook ou_create_post.d/70http-api_school_create was in the wrong package, which lead to "ImportError: No module named django" when run. [4.3] 1db298086 Bug #45749: fix hook belonging to wrong package Minor fixes: [4.3] 48afe5959 Bug #45749: remove redundant dependency [4.3] 839bfa7b0 Bug #45749: fix docstring [4.3] 47ea4fa5c Bug #45749: changelog [4.3] abc1c9579 Bug #45749: advisory update ucs-school-import (16.0.2-16)
OK: manual test against https://$FQDN/api/v1/roles/ OK: manual test against https://$FQDN/api/v1/schools/$OU/roles/ OK: advisory OK: package built and installable OK: script is in the correct package
UCS@school 4.3 v4 has been released. https://docs.software-univention.de/changelog-ucsschool-4.3v4-de.html If this error occurs again, please clone this bug.