Skip to content

Conversation

@AlexVelezLl
Copy link
Member

@AlexVelezLl AlexVelezLl commented Sep 18, 2025

Summary

  • Check unusable device on user_auth plugin.
  • Move deprovision command logic to be a utils module so it can be reused in the command and in an async task.
  • Clear the job store when deprovisioning the device.
  • Fixes several places in the soud sync process that were relying on FacilityUsers.objects.get to support soft-deleted and hard-deleted syncs.
Grabacion.de.pantalla.2025-10-01.a.la.s.1.19.22.p.m.mov

References

Closes #13397

Notes

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... SIZE: very small labels Sep 18, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 18, 2025

@github-actions github-actions bot added APP: User Re: User app (sign-in, sign-up, user profile, etc.) DEV: frontend SIZE: medium labels Sep 19, 2025
@AlexVelezLl AlexVelezLl force-pushed the handle-soft-delete-users-in-lod branch from 92888d6 to b207005 Compare September 19, 2025 19:43
@AlexVelezLl AlexVelezLl changed the title [IGNORE_THIS_PR] Check all_objects facility users for sync queue api view [DO_NOT_IGNORE_THIS_PR_ANYMORE] Check all_objects facility users for sync queue api view Sep 19, 2025
@AlexVelezLl AlexVelezLl changed the title [DO_NOT_IGNORE_THIS_PR_ANYMORE] Check all_objects facility users for sync queue api view [DO_NOT_IGNORE_THIS_PR_ANYMORE] Check unusable device on user_auth plugin Sep 19, 2025
@AlexVelezLl AlexVelezLl changed the title [DO_NOT_IGNORE_THIS_PR_ANYMORE] Check unusable device on user_auth plugin Check unusable device on user_auth plugin Sep 19, 2025
@AlexVelezLl AlexVelezLl force-pushed the handle-soft-delete-users-in-lod branch from b207005 to 3be12eb Compare September 19, 2025 20:05
@AlexVelezLl AlexVelezLl force-pushed the handle-soft-delete-users-in-lod branch from 28ad678 to bd35f6a Compare October 1, 2025 14:14
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

Just one question - I'll tag in @pcenov to confirm the fix.

Comment on lines +114 to +115
clearTasks();
redirectBrowser();
Copy link
Member

Choose a reason for hiding this comment

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

When the browser redirects here is there a chance we'd end up cancelling/clobbering the async function call through page navigation? This initially stuck out to me because you call an async function synchronously which seems less problematic above, but here I wonder if we might miss out on clearing the tasks if these run synchronously

Copy link
Member Author

Choose a reason for hiding this comment

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

It shouldn't; we are not setting an abort controller on page navigation, therefore, the request won't be aborted. What we are not doing here is not caring about the API response and whether it was successful or not. But in theory, in this case, if the clear tasks fail, it is not enough reason to stop the user workflow. So, awaiting the clear tasks to finish would make sense here if we want to set up a retry logic until the tasks are actually cleared, but we haven't done this in any other place.

@nucleogenesis nucleogenesis requested a review from pcenov October 21, 2025 22:14
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.

LGTM, implemented as specified above but in order to fully test it I will need #13757 implemented.
At this point I can confirm that if the superuser is removed on the server, then once this gets synced to the device, if I sign out and attempt to sign in I am seeing the message informing me that the device is unusable.
If I restore the user and restart the app I can sign in again as the same superuser and see my previous interactions and progress made restored.
If I remove a normal learner account and sign out once this has been synced to the device, then the account is no longer listed at the sign in page. It can also be restored, and the progress made by the learner is preserved.

@rtibbles
Copy link
Member

Seems like all comments have been addressed and what can be manually QAed is checking out. I am going to merge this, so I can rebase #13757 on top for fuller QA testing (and finalization of that PR).

@rtibbles rtibbles merged commit 63b19d7 into learningequality:develop Oct 23, 2025
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APP: User Re: User app (sign-in, sign-up, user profile, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend SIZE: medium SIZE: very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUM & LOD: Soft-deleted users should be hard-deleted when synced to LOD

5 participants