jvmtech/anonymizer

在 Neos CMS NodeTypes 和 Neos Flow Domain Models 中匿名化属性值

1.1.3 2024-06-20 04:54 UTC

This package is auto-updated.

Last update: 2024-09-20 05:29:16 UTC


README

Latest Stable Version License

在 Neos CMS NodeTypes 和 Neos Flow Domain Models 中匿名化属性值。

alt text

安装

composer require jvmtech/anonymizer

支持的属性类型

  • 文本
  • 日期时间
  • 资产
    • text/csv
    • image/gif
    • image/jpeg
    • video/mp4
    • application/pdf
    • image/png
    • image/svg+xml
    • text/plain
    • video/webm
    • application/zip
    • application/vnd.oasis.opendocument.text
    • application/vnd.openxmlformats-officedocument.wordprocessingml.document
    • application/vnd.openxmlformats-officedocument.presentationml.presentation
    • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    • 可通过配置扩展...

配置

JvMTECH:
  Anonymizer:
    nodeTypes:

      'Your.Vendor:Your.NodeType':
        properties:
          name:
            anonymize: true
          email:
            shuffle: true
          video:
            anonymize: true

    domainModels:

      'Your\Vendor\Domain\Repository\YourModelRepository':
        dateTimeFilter: # optional
          propertyName: 'creationDateTime'
          olderThan: -90 # days
          # olderThan: '2023-01-01 00:00:00' # or by date
        properties:
          name:
            anonymize: true
          email:
            shuffle: true
          video:
            anonymize: true

示例用法 "删除 90 天前的用户数据"

  1. 添加一个 "Your\Vendor\Domain\Repository\YourModelRepository" 配置,包含 dateTimeFilter.propertyName: 'creationDateTime'dateTimeFilter.olderThan: -90,以及匹配的属性设置
  2. 每月运行一次匿名化命令 ./flow anonymize:domainmodels --only "Your\Vendor\Domain\Repository\YourModelRepository" --force

示例用法 "为本地开发创建干净数据"

  1. 添加一个 "Your.Vendor:Your.NodeType" 配置,包含匹配的属性设置
  2. 克隆生产项目容器
  3. 运行匿名化命令 ./flow anonymize:nodetypes --force./flow anonymize:domainmodels --force
  4. 删除所有不需要的资产 ./flow media:removeunused --assume-yes
  5. 执行您需要做的更具体的事情
  6. 现在使干净的容器或数据转储对您的团队可访问

愿望列表

  • 按日期时间过滤以处理旧数据的自动匿名化
  • 定义特定类型范围的选项
    • 例如,日期时间:"从初始值随机加减 6 个月"
    • 例如,数字:"介于 100 和 1000 之间的随机数"
  • 定义自定义匿名化方法的选项
  • 资产的像素化,而不仅仅是替换
  • 欢迎其他有用的 PR 和想法!

jvmtech.ch 提供