Begin work on a data request API (#4045)

[Core] Data Deletion And Disclosure APIs

 - Adds a Data Deletion API
   - Deletion comes in a few forms based on who is requesting
   - Deletion must be handled by 3rd party
 - Adds a Data Collection Disclosure Command
   - Provides a dynamically generated statement from 3rd party
   extensions
 - Modifies the always available commands to be cog compatible
   - Also prevents them from being unloaded accidentally
This commit is contained in:
Michael H
2020-08-03 09:09:07 -04:00
committed by GitHub
parent bb1a256295
commit c0b1e50a5f
38 changed files with 1761 additions and 222 deletions

View File

@@ -10,6 +10,8 @@ __all__ = [
"PRAGMA_SET_read_uncommitted",
"PRAGMA_FETCH_user_version",
"PRAGMA_SET_user_version",
# Data Deletion statement
"HANDLE_DISCORD_DATA_DELETION_QUERY",
# Playlist table statements
"PLAYLIST_CREATE_TABLE",
"PLAYLIST_DELETE",
@@ -82,6 +84,33 @@ PRAGMA_SET_user_version: Final[
pragma user_version=3;
"""
# Data Deletion
# This is intentionally 2 seperate transactions due to concerns
# Draper had. This should prevent it from being a large issue,
# as this is no different than triggering a bulk deletion now.
HANDLE_DISCORD_DATA_DELETION_QUERY: Final[
str
] = """
BEGIN TRANSACTION;
UPDATE playlists
SET deleted = true
WHERE scope_id = :user_id ;
UPDATE playlists
SET author_id = 0xde1
WHERE author_id = :user_id ;
COMMIT TRANSACTION;
BEGIN TRANSACTION;
DELETE FROM PLAYLISTS
WHERE deleted=true;
COMMIT TRANSACTION;
"""
# Playlist table statements
PLAYLIST_CREATE_TABLE: Final[
str