Stop accounts.eclipse.org from directly modifying the user_delete_request table
All our Drupal websites interact with our Deletion API except for accounts.eclipse.org.
The Reason:
accounts.eclipse.org site is where the deletion process is initiated and where the final steps of deleting a user occurs. This includes verifying that all sites have reported back. Once validated, the accounts site handles:
- Deleting the Drupal user on accounts.eclipse.org
- Cleaning up all records for that particular user in the
user_delete_request
table - Sending notification emails
To allow the accounts site to stop interacting directly with the database, we need to make some changes to the API:
-
Create an Endpoint to Retrieve Users Ready for Deletion:
We need an endpoint that allows us to retrieve all users ready for deletion on accounts.eclipse.org. The corresponding Drupal query is as follows:$sql = db_select('eclipse_api_user_delete_request', 'd')->fields('d'); $sql->addExpression('COUNT(d.name)', 'count'); $sql->condition('status', 0); $sql->groupBy('name'); $sql->havingCondition('count', '1');
-
Enable the API Deletion Service to Clean Deletion Records:
The API should be capable of cleaning up deletion records, which could be managed via a cron task.
Imagine the accounts would notify the user deletion service when a user is deleted on accounts.eclipse.org (just like any other host). A cron task could then automatically delete all the deletion records for that user.
We could find out all the user that are ready to be deleted by modifying the previous query. We would want to change $sql->havingCondition('count', '1'); to $sql->havingCondition('count', '0');