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
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace Modules\Core\Privacy;
use Lunar\Models\Customer;
/**
* Identifies "the business account" for a Customer-scoped data-subject request —
* erasing/exporting a Customer's own data (orders, addresses, the account record
* itself). Deliberately carries no userIds/email: Customer-scope must never touch
* any linked User's login or personal identity, only the account's own data — see
* docs/privacy.md "User-scope vs Customer-scope". A provider that needs to know
* which Users are linked (e.g. to export their names as account contacts, without
* erasing their logins) looks that up itself via the Customer model, rather than
* this value object handing it out — keeping "erase a Customer" structurally
* incapable of touching a User row is the whole point of the split.
*/
class CustomerSubject
{
public function __construct(
public readonly int $customerId,
) {}
public static function forCustomer(Customer $customer): self
{
return new self(customerId: $customer->id);
}
}