dbrekelmans/gdpr-tools

此包已被废弃且不再维护。作者建议使用 dbrekelmans/gdpr-tools 包。

帮助符合GDPR的辅助工具。

dev-master 2018-07-05 13:23 UTC

This package is not auto-updated.

Last update: 2022-02-01 13:13:54 UTC


README

待办事项

  • 支持截断配置的预设和自定义
  • 检查生成的唯一值是否已存在于当前数据库中(否则在更新时将因为逐行更新而出现重复约束)
  • 完善README
  • 在GitHub wiki上记录yaml配置规范的文档
  • 支持配置预设的表名前缀

安装

composer require dbrekelmans/gdpr-tools

使用

php vendor/dbrekelmans/gdpr-tools/console.php <command>

命令

命令 描述 参数
db:anonymise 根据yaml配置匿名化数据库。 file - 一个yaml配置文件,必须以 .yml 结尾。有关详细信息,请参阅 配置
db:truncate 根据yaml配置截断数据库表。 file - 一个yaml配置文件,必须以 .yml 结尾。有关详细信息,请参阅 配置

配置

类型

类型 选项 描述
string minlength, maxlength 长度在 minlengthmaxlength 之间的随机字符串。
int min, max 介于 minmax 之间的随机整数(包含)。
email 有效的电子邮件地址。
ip 有效的IPv4地址。
regex pattern 基于正则表达式 pattern 的随机字符串。
null 一个NULL值。
password encryption 具有特定 encryption 的密码。

示例

database:
  scheme: pdo_mysql
  host: 127.0.0.1
  port: 3306
  name: dbname
  user: dbuser
  password: dbpass

truncate:
  - webform_submissions
  - webform_submissions_data

anonymise:
  presets:
    - drupal8
  
  custom:
    anonymise_example:
      email:
        type: 
          name: email
        unique: true
      password:
        type:
          name: password
          options:
            encryption: sha512
      name:
        type: 
          name: string|null
      ip:
        type:
          name: ip
      number:
        type:
          name: int|null
          options:
            min: 0
            max: 100
        
  exclude:
    drupal8:
      users_field_data:
        uid:
          - 0
          - 1
          - 46
    custom:
      anonymise_example:
        id:
          - 2
          - 5
        email:
          - example@example.com