-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for GDPR exports (#349)
* feat: add support for blomstra/gdpr * Bump js deps, modify default downloader * Apply fixes from StyleCI * chore: disable ts for now --------- Co-authored-by: StyleCI Bot <[email protected]>
- Loading branch information
1 parent
0e82c49
commit 57ddc06
Showing
12 changed files
with
2,414 additions
and
633 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: FoF Upload PHP | ||
|
||
on: [workflow_dispatch, push, pull_request] | ||
|
||
jobs: | ||
run: | ||
uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@main | ||
with: | ||
enable_backend_testing: false | ||
|
||
backend_directory: . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of fof/upload. | ||
* | ||
* Copyright (c) FriendsOfFlarum. | ||
* Copyright (c) Flagrow. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FoF\Upload\Data; | ||
|
||
use Blomstra\Gdpr\Data\Type; | ||
use FoF\Upload\Downloader\DefaultDownloader; | ||
use FoF\Upload\File; | ||
use PhpZip\ZipFile; | ||
|
||
class Uploads extends Type | ||
{ | ||
public function export(ZipFile $zip): void | ||
{ | ||
/** @var DefaultDownloader $downloader */ | ||
$downloader = resolve(DefaultDownloader::class); | ||
|
||
File::query() | ||
->where('actor_id', $this->user->id) | ||
->orderBy('id', 'asc') | ||
->each(function (File $file) use ($zip, $downloader) { | ||
$fileContent = $downloader->download($file)->getBody()->getContents(); | ||
$zip->addFromString( | ||
"uploads/{$file->path}", | ||
$fileContent | ||
); | ||
}); | ||
} | ||
|
||
public function anonymize(): void | ||
{ | ||
File::query() | ||
->where('user_id', $this->user->id) | ||
->update([ | ||
'actor_id' => null, | ||
]); | ||
} | ||
|
||
public function delete(): void | ||
{ | ||
File::query() | ||
->where('user_id', $this->user->id) | ||
->delete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters