Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure facility id is properly sent to public signup viewset. #11846

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented Feb 7, 2024

Summary

  • The remote user sign up viewset was sending the facility id as facility_id instead of the expected facility
  • This caused things to go wrong when signing up to a device with more than one facility

References

Fixes #11832

Reviewer guidance

Use the database from the linked issue for a server device, and then attempt to create a new user account for jerrym username on the second facility (imported from Win11).


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@rtibbles rtibbles added the TODO: needs review Waiting for review label Feb 7, 2024
@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) SIZE: very small labels Feb 7, 2024
@bjester
Copy link
Member

bjester commented Feb 7, 2024

I believe this nuance was my reasoning for adding a constant for it, which could be used here?

FACILITY_CREDENTIAL_KEY = "facility"

@@ -51,7 +51,9 @@ def createuseronremote(self, request):
url = "{}{}".format(baseurl, api_url)

payload = {
"facility_id": facility_id,
# N.B. facility is keyed by facility not facility_id on the signup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's N.B. mean here?

Why not update the serializer field to be facility_id instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many other places to have to change on the frontend I suspect?

In any case, change looks good to me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nota Bene - note well.

Changing the public serializer would involve changing the serializer for all signups, so would be a fairly significant change. If I was going to make a more dramatic change here, I would propagate this back through this API endpoint (to be facility all the way) but this seemed like the least dramatic fix this close to release.

@pcenov pcenov self-requested a review February 8, 2024 15:50
Copy link
Member

@pcenov pcenov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm that the issue reported in #11832 is fixed now and the learner user is created in the correct facility. Also no issues observed while regression testing.

Copy link
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manual QA passed, good to go! 💯 :shipit:

@rtibbles
Copy link
Member Author

rtibbles commented Feb 8, 2024

Yes @bjester that does seem appropriate! I'll update.

@rtibbles rtibbles merged commit dc97e82 into learningequality:release-v0.16.x Feb 8, 2024
34 checks passed
@rtibbles rtibbles deleted the two_facilities_are_better_than_one branch February 8, 2024 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) DEV: backend Python, databases, networking, filesystem... SIZE: very small TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants