events: add gdpr_compliance option

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

#1551
This commit is contained in:
Jens Langhammer
2021-11-16 11:29:13 +01:00
parent 047030f901
commit f4db09cd59
4 changed files with 27 additions and 2 deletions

View File

@ -106,3 +106,11 @@ def notification_transport(self: MonitoredTask, notification_pk: int, transport_
except NotificationTransportError as exc:
self.set_status(TaskResult(TaskResultStatus.ERROR).with_error(exc))
raise exc
@CELERY_APP.task()
def gdpr_cleanup(user_pk: int):
"""cleanup events from gdpr_compliance"""
events = Event.objects.filter(user__pk=user_pk)
LOGGER.debug("GDPR cleanup, removing events from user", events=events.count())
events.delete()