heimrichhannot/contao-privacy

此捆绑包包含有关隐私和欧盟“通用数据保护条例”(GDPR,在德语中为“Datenschutz-Grundverordnung”,DSGVO)的功能。

安装次数: 1,389

依赖项: 1

建议者: 0

安全: 0

星标: 0

关注者: 7

分支: 2

开放问题: 2

类型:contao-module

2.2.2 2023-02-09 10:45 UTC

README

对于 Contao 4 和 PHP 8,请使用 https://github.com/heimrichhannot/contao-privacy-bundle

此捆绑包包含有关隐私和欧盟“通用数据保护条例”(GDPR,在德语中为“Datenschutz-Grundverordnung”,DSGVO)的功能。

法律免责声明

使用此捆绑包自行承担风险。尽管我们作为开发者尽力设计此捆绑包以满足法律要求,但我们不能保证完整性和正确性。此外,我们不提供任何法律咨询。我们强烈建议您在有任何问题或疑虑时咨询律师。

功能

  • 隐私协议
    • 添加了新的 Contao 实体 tl_privacy_protocol_archivetl_privacy_protocol_entry,用于存储隐私相关的操作,如同意...
    • 提供了一个简单的 API,用于向隐私协议中添加新条目
    • 提供了创建新隐私协议条目的功能,用于 tl_member 回调(oncreate_callbackonversion_callbackondelete_callback
  • 带有连接到隐私协议的前端 opt-in/out 表单
  • 后端 opt-in 邮件模块,用于“邀请”用户同意隐私相关的协议

安装

  1. 简单使用 composer 安装:composer require heimrichhannot/contao-privacy
  2. 更新您的数据库并清除您的缓存。
  3. 现在您在 Contao 左侧菜单中有了新的“隐私”菜单项

支持 Contao 隐私捆绑包的现有捆绑包

我们已经实现了一些捆绑包的支持

  • heimrichhannot/contao-formhybrid:此捆绑包提供了在前端创建 DCA 驱动的表单的功能,包括回调、输入类型、电子邮件处理等。通过安装 Contao 隐私捆绑包,您还可以在表单提交后添加协议条目的复选框。
  • heimrichhannot/contao-cleaner-bundle:此捆绑包添加了定期删除满足特定条件的任意实体和/或文件的功能(使用 TL_CRON 或您的服务器的 cron)。

导出隐私协议

可以将隐私协议条目导出为 csvexcel。为了使用此功能,只需安装以下 composer 模块之一

  • 对于 contao 3.x:composer require heimrichhannot/contao-exporter
  • 对于 contao 4.x:composer require heimrichhannot/contao-exporter-bundle

用法

隐私协议

  1. 添加新的协议存档并选择您希望存储的字段(注意:不要存储您没有用户许可的个人数据!)。
  2. 选择以下功能之一以程序化添加新条目,并/或创建新条目,在创建、更新或删除成员后自动创建。

在 CRUD 操作上创建条目

您可以为以下 tl_member 回调激活自动创建隐私协议条目的功能

  • oncreate_callback
  • onversion_callback(这表示至少有一个属性实际已更改的成员更新)
  • ondelete_callback

只需打开 Contao 的全局设置(tl_settings),然后在“隐私”部分根据您的需要进行配置。

程序化创建条目

从模块的上下文中添加新条目
class MyModule {
    // ...
    public function compile() {
        // this represents your function for sending the opt in email
        $success = $this->sendOptInEmail($firstname, $lastname, $email);

        // only create a protocol entry if the email has indeed been sent
        if ($success)
        {
            $protocolManager = new \HeimrichHannot\Privacy\Manager\ProtocolManager();
            $protocolManager->addEntryFromModule(
                // the type of action
                \HeimrichHannot\Privacy\Backend\ProtocolEntry::TYPE_FIRST_OPT_IN,
                // the id of your destination protocol archive
                1,
                // the data you want to add to the protocol entry to be created
                // CAUTION: Do NOT store personal data for which you don't have the user's permission!
                [
                    'firstname' => $firstname,
                    'lastname'  => $lastname,
                    'email'     => $email
                ],
                // the \Contao\Module instance you're calling from
                $this,
                // optional: composer package name of the bundle your module lives in (version is retrieved automatically from composer.lock)
                'acme/contao-my-bundle'
            );
        }
    }
    // ...
}
从内容元素的上下文中添加新条目
class MyContentElement {
    // ...
    public function compile() {
        // this represents your function for sending the opt in email
        $success = $this->sendOptInEmail($firstname, $lastname, $email);

        // only create a protocol entry if the email has indeed been sent
        if ($success)
        {
            $protocolManager = new \HeimrichHannot\Privacy\Manager\ProtocolManager();
            $protocolManager->addEntryFromContentElement(
                // the type of action
                \HeimrichHannot\Privacy\Backend\ProtocolEntry::TYPE_FIRST_OPT_IN,
                // the id of your destination protocol archive
                1,
                // the data you want to add to the protocol entry to be created
                // CAUTION: Do NOT store personal data for which you don't have the user's permission!
                [
                    'firstname' => $firstname,
                    'lastname'  => $lastname,
                    'email'     => $email
                ],
                // the \Contao\ContentElement instance you're calling from
                $this,
                // optional: composer package name of the bundle your content element lives in (version is retrieved automatically from composer.lock)
                'acme/contao-my-bundle'
            );
        }
    }
    // ...
}
从通用上下文中添加新条目
class MyClass {
    // ...
    public function someFunction() {
        // this represents your function for sending the opt in email
        $success = $this->sendOptInEmail($firstname, $lastname, $email);

        // only create a protocol entry if the email has indeed been sent
        if ($success)
        {
            $protocolManager = new \HeimrichHannot\Privacy\Manager\ProtocolManager();
            $protocolManager->addEntry(
                // the type of action
                \HeimrichHannot\Privacy\Backend\ProtocolEntry::TYPE_FIRST_OPT_IN,
                // the id of your destination protocol archive
                1,
                // the data you want to add to the protocol entry to be created
                // CAUTION: Do NOT store personal data for which you don't have the user's permission!
                [
                    'firstname' => $firstname,
                    'lastname'  => $lastname,
                    'email'     => $email
                ],
                // optional: composer package name of the bundle your code lives in (version is retrieved automatically from composer.lock)
                'acme/contao-my-bundle'
            );
        }
    }
    // ...
}

协议条目编辑器

模块 ModuleProtocolEntryEditor 可用于在隐私协议中创建条目。通常您会遇到以下场景:

进行双重确认以获取某些行动的同意(例如,发送广告邮件)

在这种情况下,您可以:

  • 显示一个带有您指定的 DCA 字段的表单(通常这是 tl_member)——> 用户可以在这里输入他的数据 (注意:只要求填写您请求确认的操作所必需的字段)
  • 此表单可以使用生成的预填 URL 进行预填,该 URL 可由插入标记 privacy_opt_url 生成(请参阅插入标记章节)
  • 您还可以通过在模块配置中不选择任何字段来避免显示任何字段
  • 在表单中点击“提交”后,用户通常会收到一封确认其同意的电子邮件(使用 contao 通知中心),您只能在没有法律问题的情况下跳过确认
  • 您可以指定在提交和确认后应生成的协议条目

进行单次退出以撤销某些行动的同意(例如,发送广告邮件)

您可以像执行单次操作一样执行此操作

后端 Opt-In 表单

导航到左侧隐私部分的“确认”以向特定电子邮件地址发送确认电子邮件。表单的工作方式如下

  1. 您在表单中输入的信息被转换为加密的 JWT 令牌,并附加到通知电子邮件中的预填链接(使用插入标记 privacy_opt_url 创建)
  2. 用户点击链接后,将被重定向到一个包含模块 ModuleProtocolEntryEditor 的页面。此模块识别 JWT 参数,并使用它来预填表单,以便用户只需点击“提交”
  • 提示:您在后台 Opt-In 表单中输入的数据不会直接存储到您的数据库中。唯一发生这种情况的情况是以加密的方式作为 JWT 令牌存储在 contao 通知中心的通告队列中。因此,请使用类似 heimrichhannot/contao-cleaner-bundle 的模块定期删除此令牌数据。*

插入标记