Feature: Creating Privacy Basics

This commit is contained in:
2026-08-24 21:06:11 +03:00
parent e31de1b4e3
commit 9f540cbaa4
38 changed files with 1969 additions and 3 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Modules\Core\Privacy;
use Illuminate\Contracts\Auth\Authenticatable;
use Lunar\Base\LunarUser;
/**
* Identifies "the person" for a User-scoped data-subject request — erasing/
* exporting one individual's own identity (login, name, email) wherever it
* appears, regardless of how many Customer (business) accounts they're linked to.
* Deliberately carries no customerId: a provider that needs to know which
* Customer accounts this User is linked to (e.g. to detach them, or to find data
* keyed by a shared email) looks that up itself, rather than this value object
* assuming one fixed Customer — the whole point is that one User can belong to
* many Customer accounts (B2B multi-seat access) and erasing the User must not
* assume or privilege any single one of them.
*/
class UserSubject
{
public function __construct(
public readonly int $userId,
public readonly ?string $email = null,
) {}
public static function forUser(Authenticatable&LunarUser $user): self
{
return new self(userId: $user->id, email: $user->email);
}
}