Skip to content

Commit

Permalink
chore: compatability gdpr beta 17 (#354)
Browse files Browse the repository at this point in the history
* chore: compatability gdpr beta 17

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
imorland and StyleCIBot authored Oct 25, 2023
1 parent cb8e901 commit 09d7c18
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"php": ">=8.0",
"ext-json": "*",
"enshrined/svg-sanitize": "^0.15.4",
"flarum/core": "^1.8.0",
"flarum/core": "^1.8.3",
"guzzlehttp/guzzle": "^6.0 || ^7.0",
"ramsey/uuid": "^3.5.2 || ^4",
"softcreatr/php-mime-detector": "^3.0"
Expand Down
5 changes: 3 additions & 2 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
->handler(InvalidUploadException::class, ExceptionHandler::class),

(new Extend\Conditional())
->whenExtensionEnabled('blomstra-gdpr', [
class_exists(UserData::class) ? (new UserData())->addType(Data\Uploads::class) : null,
->whenExtensionEnabled('blomstra-gdpr', fn () => [
(new UserData())
->addType(Data\Uploads::class),
]),
];
15 changes: 15 additions & 0 deletions src/Data/Uploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

class Uploads extends Type
{
public static function exportDescription(): string
{
return 'All files uploaded by the user.';
}

public function export(ZipFile $zip): void
{
/** @var DefaultDownloader $downloader */
Expand All @@ -36,6 +41,11 @@ public function export(ZipFile $zip): void
});
}

public static function anonymizeDescription(): string
{
return 'Removes the user reference from the uploaded files. The files themselves remain accessible to users that could view them pre-anonymization.';
}

public function anonymize(): void
{
File::query()
Expand All @@ -45,6 +55,11 @@ public function anonymize(): void
]);
}

public static function deleteDescription(): string
{
return 'Currently, the file entry is removed from the database, but the file itself is not deleted. This will change to include removing the file from the disk before the stable release of GDPR.';
}

public function delete(): void
{
// TODO: this currently only removes the entry from the DB, we also need to remove the files from storage.
Expand Down

0 comments on commit 09d7c18

Please sign in to comment.