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
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
Comment on lines 502 to 514
device_is_provisioned = False


def is_provisioned():
# First check if the device has been provisioned
global device_is_provisioned
device_is_provisioned = device_is_provisioned or device_provisioned()
return device_is_provisioned


def reset_device_provisioned_flag():
global device_is_provisioned
device_is_provisioned = False
Copy link
Member

Choose a reason for hiding this comment

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

You didn't add this code, but I have some confidence this will not create the desired effect in the Android app. The global variable used as a cache is problematic in situations where tasks and the the server are run in different processes, such as the Android app and BCK (not a LOD use case, I know).

It isn't clear to me from the original PR whether this was added to improve performance, but DeviceSettings, where the provisioned status is stored, has a caching layer. It seems like it might have been added to sidestep the database being ready. If we haven't already, I would try removing this global flag to see whether there is any detriment. I think it would be much better to have this gone then to keep it around.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yes, nice catch! I forgot the tasks run in a different process in the Android App. I can try removing this global variable and see how it goes!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@AlexVelezLl AlexVelezLl force-pushed the handle-soft-delete-users-in-lod branch from 28ad678 to bd35f6a Compare October 1, 2025 14:14
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
4 participants