-
Notifications
You must be signed in to change notification settings - Fork 87
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
Allow trashed events to be deleted and at the same time prevent them from orphaning other data records GDPR #349
Comments
Hey Seth ya this sounds like an important feature for allowing admins to clear out old events, but I'm not sure why this is categorized as a security issue. |
Oops. Didn't mean to do that. I updated the category to GDPR. |
Would this also allow for deleting events that have registrations? |
I don't think it's been specified. What would customers probably want to happen when deleting an event with registrations? orphan them? block deletion of the event until registrations are deleted? automatically delete all the registrations too? |
The current behavior is it blocks deletion of the event until registrations are deleted. Would it be OK to instead allow the event to be deleted and orphan the registrations? |
It would certainly test how defensive our code- the code should generally just say "oups, can't find the event for this registration" and then keep working. But there may be the odd fatal error that would happen because we got careless. Although I've reviewed this ticket some more: I think this work would only help with GDPR and user privacy etc if it actually facilitated deleting registrations/contacts. Just deleting the event and orphaning the registrations doesn't help with GDPR because the personal information (on the registration and contact) is still in the system. I'm actually not sure what use-case facilitating just deleting the event (and orphaning its related data) would benefit. So I would think this is really only useful if it will also delete the personal information contained on registrations and contacts etc. |
Since there's likely a lot of data that may need to be deleted, would this be something we'd use the Batch system to break things up into smaller requests? On a site without MER, it'd probably be fairly straightforward to delete an event and its related data: Delete:[ ] - event post in wp_posts Do not delete[ ] - Contacts related to the registrations would remain because you can have contacts without a registration, and there may be other registrations for other events attached to any given Contact. [ ] - Where things could get sticky is on sites where MER is activated. Maybe that would require doing a check on the transactions and if the transaction has line items from other events, then the transaction needs to persist. |
Yes I think that would be appropriate (especially for those events with hundreds of attendees).
I suspect users will be divided on this: some will want the contacts gone too (eg if the contacts are only for one event and the event manager is trying to adhere to GDPR's "Privacy by Design" and delete old data), while others will want to keep them. It's a similar situation with venues (and transactions with MER, like you mentioned), because those can be for different events. I think it would be best if we asked users if they want to delete contacts, transactions, venues, etc (provided they're not in use by other events); and it would be nice to have a confirmation page (where we display what data, including related data, will get deleted) |
I don't think venues should be deleted when an event is deleted. The relationship between an event and venue would be deleted, but allowing a venue to be deleted when an event is deleted would probably lead to accidental deletion of venues. A user can delete venues already via the Venues list table. |
Here's my attempt at "shaping" this task. Up for debate. The ProblemUsers often want to delete events to either clear our their event backlog, or in order to remove personal information of contacts.
The AppetiteI'd say this is a fairly major administrative feature. While its possible to work around it, it's not reasonable for events with over a dozen-or-so registrations. UI ConsiderationsFor the first version, I'd like to not bother with any options, and just delete the essential stuff. Following Josh's list IMO that's:
Contacts and transactions (and the transaction's associated payments and line items) can exist OK without associated events. So for the initial version of this, I'm inclined to leave them. @joshfeck do we want to have a confirmation page? A page that could confirm everything that will get deleted with the event. Something like this (from Django): When it comes time to do the actual deleting, I think we'd send the user to a batch process page, where they could see the progress of the deletion. Code ConsiderationsThere are two main approaches I see for implementing this: A) select then start deleting, or B) just immediately start deleting. Regardless, we'll need a way to traverse the tree of model objects. Eg you pass the event into a model instance (ie an So for an event that algorithm would visit:
There are a few more models we would probably want to delete, just because they aren't accessible in the UI without going through an event (even though theoretically there could be an admin page listing them independently of events):
Because it's the controller-layer ( And, for a v2, I would suggest we could then give users the option to also delete:
And each of their postmetas, extra metas, and extra join entries. If we want a confirmation page, it might be tricky to generate that page for very large events and avoid timeouts. It seems reasonable to just fetch the first 100 or 200 items; and then say "...more". If that's not ok, we'd probably need another batch job for first fetching all the data to delete (in addition to the batch job for processing deletions.) I think option A (fetching all the items-to-delete before actually beginning to delete them) is probably more useful. Besides allowing us to have a confirmation page, we'll know how many items to delete so we can display a proper progress bar, and we could probably write more efficient SQL delete queries (eg delete all the event's registrations' answers in a single query rather than one query per registration). It may also be useful even when we don't want to recursively delete, because we can show the user what data is blocking deletions. Rabbit Holes to AvoidTransactional queriesWhat happens if a deletion query fails mid-query? If it were all part of a database transaction, we could revert what had already been deleted, in order to keep the database in a "valid" state. If we first select everything to delete, store it somewhere, then delete it as part of a batch process, we'll be keeping track of the progress as we go. If a problem occurs mid-request, we can pickup where we left off (that's what the batch system does naturally.) Refactoring the modelsI don't think this will necessitate refactoring models, although I'm sure we'll see plenty of ways to improve them. I'd like to build this as a separate system that uses the models, but not as part of the models. We may need to store a little more information about model relations (eg across which relations do we want to propogate the deletion), but I think we already have what we need. Any other rabbit holes where we could get lost (ie, consume a ton of time without doing anything currently needed) working on this? I think I'd first like Josh's feedback on the UX and rabbit holes to avoid, then get Brent's feedback on the implementation details |
This is true, but as it stands now, a transaction must have at least one registration. Otherwise there's a fatal error:
We could make the above more defensive to avoid fatal errors. Not deleting transactions does solve the problem of what to do about MER and how it allows a transaction to have registrations from several events. So no issue if all registrations from one event are deleted, and some transactions have registrations from that event and registrations from other events. The downside would be there's currently no UI to delete transactions, which between those and line items it can also add quite a bit of data onto the database.
Either a confirmation page or an alert that allows the user to get out if they got there by mistake. |
I'd be inclined to get this working without deleting transactions (assuming it doesn't take a crazy amount of effort to avoid that fatal error you mentioned and others like it), and then add the ability to delete transactions on a separate ticket.
I'm inclined to do the confirmation page because it's also an opportunity to point out all the related data that will get deleted... Any further thoughts on that? If not, we should probably get feedback from Brent next. |
It probably wouldn't take much to make the code a bit more defensive. |
KK, I'd like to make a p2 with a proposal, especially looking for feedback from Brent and anyone who wants to chime in. |
Here's the p2, based on my earlier post on this ticket, but I removed some of the questions because I get the impression we're inclined to have the confirmation page, and will leave transactions alone initially. (If that' incorrect chime in here or there.) While I'm open to feedback from everyone, I think only Brent's additional blessing is needed to move forward. |
Ok so the main feedback from the p2 so far is:
|
I've created sub-tickets for the different parts of this project, so closing this one |
See original Codebase ticket:
https://events.codebasehq.com/projects/event-espresso/tickets/9009
This has come up in the forums and I think there's some room for improvement when it comes to making things easier for event managers.
Steps to reproduce:
Result is you'll see some errors that say you can't delete the event. So now you have to go and restore the event from the trash, then you have to edit the event, and remove all of the relationships to things like People CPts. Then trash, then you can permanently delete.
Can we change the above so the relationships automatically get removed so all they'll have to do is trash then delete the event?
The text was updated successfully, but these errors were encountered: