synolia / SyliusGDPRPlugin

Make your Sylius project GDPR compliant.
European Union Public License 1.2
18 stars 8 forks source link

[Feature] Exclude properties from anonimisation #61

Open revoltek-daniel opened 6 months ago

revoltek-daniel commented 6 months ago

Is your feature request related to a problem? Please describe. We only want to anonymise the customer object but keep the Order for compliance reasons

Describe the solution you'd like An attribute or configuration in the yaml file to exclude a property/object from anonimisation. Or handle the stop state of events after they are called. Or add a try catch block to let me throw an exception to stop further execution when the object is being handled.

Describe alternatives you've considered I've tried using the events but I can't find a way to cancel the execution.

maxperei commented 5 months ago

hello @revoltek-daniel, actually it is already possible to exclude some entities from being anonymized, for instance if you want to ignore orders you have to define explicitely a mapping in your config folder

# {{projectDir}}/config/packages/synolia_sylius_gdpr.yml
synolia_sylius_gdpr:
   anonymization:
       mappings:
           paths:
               - '%kernel.project_dir%/config/gdpr'

when mappings.paths is directly pointing towards your entities configuration :

# {{projectDir}}/config/gdpr/order.yml
Sylius\Component\Core\Model\Order:
    properties:
        shippingAddress: ~
        billingAddress: ~
        payments: ~
        currencyCode: ~
        localeCode: ~
        customerIp: ~
        notes: ~

btw, ANONYMIZE_CONFIGURATION.md is giving you an exhaustive list of properties you can utilize

nb: this plugin also let you use phpdoc annotations if this is more convenient

please let us know if this answer is what you expected..