synolia/sylius-gdpr-plugin

Synolia sylius GDPR插件。

安装数: 78,499

依赖项: 0

建议者: 0

安全: 0

星标: 18

关注者: 13

分支: 8

公开问题: 2

类型:sylius-plugin


README

License CI - Analysis CI - Sylius Version Total Downloads

Sylius GDPR插件

Capture

功能

  • 在管理员的客户展示页面中使用GDPR部分匿名化客户。
  • 在管理员的客户展示页面中使用GDPR部分导出客户数据。

点击查看匿名化配置.

点击查看导出数据配置.

  • 使用命令匿名化任何实体,例如
php bin/console synolia:gdpr:anonymize --entity='Sylius\Component\Core\Model\Customer' --id=1 

使用 --help 获取更多信息

要求

安装

  1. 在您的 composer.json 中添加包及其依赖项

    composer require synolia/sylius-gdpr-plugin --no-scripts
  2. 在您的 config/packages/_sylius.yaml 文件中导入所需配置

    imports:
        - { resource: "@SynoliaSyliusGDPRPlugin/Resources/config/app/config.yaml" }
  3. 在您的 config/routes.yaml 文件中导入路由

    synolia_gdpr:
        resource: "@SynoliaSyliusGDPRPlugin/Resources/config/routes.yaml"
  4. 处理翻译

    php bin/console translation:extract en SynoliaSyliusGDPRPlugin --dump-messages
    php bin/console translation:extract fr SynoliaSyliusGDPRPlugin --dump-messages
  5. 清除缓存

    php bin/console cache:clear

添加匿名化配置

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

配置示例

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 可以是 null、数组、整数、字符串以及 表达式语言

带有动态值的配置示例

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

注意

您的表达式语言必须以 @= 开头才能正确评估

变量 object 是您正在处理的当前实体(例如,在这种情况下是 Sylius\Component\Core\Model\Customer

在高级操作页面中添加表单

将您自定义的表单添加到页面的步骤有两个

  • 通过设置 $formsType 变量中的 FormType 链接来覆盖控制器服务
   Synolia\SyliusGDPRPlugin\Controller\AdvancedActionsController:
       arguments:
           $formsType:
               - 'Synolia\SyliusGDPRPlugin\Form\Type\Actions\AnonymizeCustomerNotLoggedSinceType'
       tags: ['controller.service_arguments']
  • 然后通过实现 Synolia\SyliusGDPRPlugin\Processor\AnonymizerProcessor\AdvancedActionsFormDataProcessorInterface 创建您的表单处理器

这里 有一个表单处理器示例

事件

  • Synolia\SyliusGDPRPlugin\Event\BeforeAnonymize
  • Synolia\SyliusGDPRPlugin\Event\AfterAnonymize
  • Synolia\SyliusGDPRPlugin\Event\BeforeCustomerAnonymize
  • Synolia\SyliusGDPRPlugin\Event\AfterCustomerAnonymize
  • Synolia\SyliusGDPRPlugin\Event\BeforeExportCustomerData

开发

请参阅 如何贡献

许可

此库受 EUPL-1.2 许可证 保护。

鸣谢

Synolia 开发。