SURFscz / SBS

Samenwerking Beheer Systeem ↣ Collaboration Management System
Apache License 2.0
3 stars 2 forks source link

If a user has a subdomain in their schachome, they can't request a new CO #1334

Closed baszoetekouw closed 3 months ago

baszoetekouw commented 3 months ago

If a user has a subdomain in their schahome, while the main domain is registered at the Org (e.g., user has student.uni-harderwijk.nl and Org has uni-harderwijk.nl), they can't request a new CO. All the UI elements work as expected, but when they submit the new CO, they get an error.

Mar 25 19:46:01 app1-tf1 gunicorn[773]: ERROR [base] user: 83a046f47dd153cc83257f01221f567e9a975227@acc.sram.eduteams.org, <Response 271 bytes [400 BAD REQUEST]>
Mar 25 19:46:01 app1-tf1 gunicorn[773]: Traceback (most recent call last):
Mar 25 19:46:01 app1-tf1 gunicorn[773]:   File "/opt/sbs/sbs/server/api/base.py", line 187, in wrapper
Mar 25 19:46:01 app1-tf1 gunicorn[773]:     body, status = f(*args, **kwargs)
Mar 25 19:46:01 app1-tf1 gunicorn[773]:   File "/opt/sbs/sbs/server/api/collaboration_request.py", line 68, in request_collaboration
Mar 25 19:46:01 app1-tf1 gunicorn[773]:     raise BadRequest(f"There is no organisation with a schac_home_organisation that equals the "
Mar 25 19:46:01 app1-tf1 gunicorn[773]: werkzeug.exceptions.BadRequest: 400 Bad Request: BadRequest: https://test.sram.surf.nl/api/collaboration_requests. IP: 145.90.230.165, 10.24.0.20. There is no organisation with a schac_home_organisation that equals the schac_home_organisation student.school4us.org of User floris5@example.com
Mar 25 19:46:01 app1-tf1 gunicorn[772]: ERROR:user:user: 83a046f47dd153cc83257f01221f567e9a975227@acc.sram.eduteams.org, {
Mar 25 19:46:01 app1-tf1 gunicorn[772]:     "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0",
Mar 25 19:46:01 app1-tf1 gunicorn[772]:     "message": "Error: ",
Mar 25 19:46:01 app1-tf1 gunicorn[772]:     "url": "https://test.sram.surf.nl/static/js/main.a0bfc09c.js",
Mar 25 19:46:01 app1-tf1 gunicorn[772]:     "line": 2,
Mar 25 19:46:01 app1-tf1 gunicorn[772]:     "col": 2178377,
Mar 25 19:46:01 app1-tf1 gunicorn[772]:     "error": "",
Mar 25 19:46:01 app1-tf1 gunicorn[772]:     "stack": "Ur/<@https://test.sram.surf.nl/static/js/main.a0bfc09c.js:2:2178377\n",
Mar 25 19:46:01 app1-tf1 gunicorn[772]:     "targetUrl": "https://test.sram.surf.nl/api/collaboration_requests",
Mar 25 19:46:01 app1-tf1 gunicorn[772]:     "status": 400
Mar 25 19:46:01 app1-tf1 gunicorn[772]: }
Mar 25 19:46:01 app1-tf1 gunicorn[772]: NoneType: None

SBS should probably use https://github.com/SURFscz/SBS/blob/main/server/db/domain.py#L831 instead of the standard SQL query.

mrvanes commented 3 months ago

This user has no relation to SBS, but home organisation foo.example.org which is a subdomain of Franeker's example.org. He is not able to request a CO: image

And this is his landing page, which should be the page with the tree. image

mrvanes commented 3 months ago

OK