How to handle batch changing acls of a table with many records?

Hello, I have a problem regarding the ACL of users who are unexpectedly deleted, but have records. I would like to know how I can transport these records to another user’s ACL efficiently.

Context:

Currently, I work on a system where there are several passengers requesting rides via the app. For each passenger, I have a user that is stored in the “_User” table and that allows me to login to the system. However, it can happen that a passenger has his user deleted for some unusual reason. Even if a new user is created for this passenger, the rides he took would not be displayed, as the acl (access control) of the rides is linked to the old (deleted) user of this passenger. I would like to know if there is any approach that can be used to migrate the acls of the rides from the old user of this passenger to the new one, without having to iterate over all the rides for that passenger.

No, you will need to do a query to fetch and add/change the ACL for each ride. Maybe a Cloud Function “afterSave” the “_User” to handle this - you should run this function on another “worker” (using Piscina for example) to not overload the “main” thread worker.