synolia / SyliusGDPRPlugin

Make your Sylius project GDPR compliant.
European Union Public License 1.2
18 stars 8 forks source link
gdpr rgpd sylius sylius-plugin

License CI - Analysis CI - Sylius Version Total Downloads

Sylius GDPR Plugin

Capture

Features

Requirements

Version
PHP ^8.0
Sylius ^1.10

Installation

  1. Add the bundle and dependencies in your composer.json :

    composer require synolia/sylius-gdpr-plugin --no-scripts
  2. Import required config in your config/packages/_sylius.yaml file:

    imports:
        - { resource: "@SynoliaSyliusGDPRPlugin/Resources/config/app/config.yaml" }
  3. Import routing in your config/routes.yaml file:

     synolia_gdpr:
         resource: "@SynoliaSyliusGDPRPlugin/Resources/config/routes.yaml"
  4. Process translations

    php bin/console translation:extract en SynoliaSyliusGDPRPlugin --dump-messages
    php bin/console translation:extract fr SynoliaSyliusGDPRPlugin --dump-messages
  5. Clear cache

    php bin/console cache:clear

Add anonymization configuration

synolia_sylius_gdpr:
    disable_default_mappings: false # False by default
    anonymization:
        mappings:
            paths:
                - # Your\Paths\To\Mappings\Directory

Example of configuration

Sylius\Component\Core\Model\Address: # Your class path
   properties:
      firstName:
         faker: text # let's see => https://fakerphp.github.io/formatters/
         args: [20] # The associated faker arguments
         prefix: 'anonymized-'
      lastName:
         value: 'Fake lastName'
         prefix: 'anonymized-'

value can be null, an array, an int, a string and an expression language

Example of configuration with dynamic value

Sylius\Component\Core\Model\Customer:
   properties:
      firstName:
          value: '@="some-arbitrary-text..." ~ object.getId() ~ "...more-arbitrary-text"'

Note:

your expression language must starts with @= to be evaluated properly

variable object is the current entity your are dealing with (eg. in that case Sylius\Component\Core\Model\Customer)

Add form in advanced actions page

There's two steps to add your custom form into the page:

There a form processor example

Events

Development

See How to contribute.

License

This library is under the EUPL-1.2 license.

Credits

Developed by Synolia.