novactive/ezprotectedcontentbundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

novactive/ezprotectedcontentbundle

最新稳定版本:v2.2.0

Composer 安装命令:

composer require novactive/ezprotectedcontentbundle

包简介

Novactive eZ Protected Content Bundle is an Ibexa bundle that provides quick protection on Contents

README 文档

README

This repository is what we call a "subtree split": a read-only copy of one directory of the main repository. It is used by Composer to allow developers to depend on specific bundles.

If you want to report or contribute, you should instead open your issue on the main repository: https://github.com/Novactive/Nova-eZPlatform-Bundles

Documentation is available in this repository via .md files but also packaged here: https://novactive.github.io/Nova-eZPlatform-Bundles/master/ProtectedContentBundle/README.md.html

Downloads Latest version License

A bundle that provides quick password protection on Contents.

How it works

Allows you to add 1 on N password on a Content in the Admin UI. Once a protection is set, the Content becomes Protected. In this situation you can have 3 new variables in the view full

  • canReadProtectedContent (always)
  • requestProtectedContentPasswordForm (if content is protected by password)
  • requestProtectedContentEmailForm (if content is protected with email verification)

Allowing you do:

<h2>{{ ibexa_content_name(content) }}</h2>
{% if not canReadProtectedContent %}
    {% if requestProtectedContentPasswordForm is defined %}
        <p>This content has been protected by a password</p>
        <div class="protected-content-form">
            {{ form(requestProtectedContentPasswordForm) }}
        </div>
    {% elseif requestProtectedContentEmailForm is defined %}
        <p>This content has been protected by an email verification</p>
            <div class="protected-content-form">
                {{ form(requestProtectedContentEmailForm) }}
            </div>
    {% endif %}
{% else %}
    {% for field in content.fieldsByLanguage(language|default(null)) %}
        <h3>{{ field.fieldDefIdentifier }}</h3>
        {{ ez_render_field(content, field.fieldDefIdentifier) }}
    {% endfor %}
{% endif %}

You can also manage this globally through the pagelayout wrapping the content block.

Once you have unlocked the content, canReadProtectedContent will be true

HTTP Cache is disabled for Protected Content.

Installation

Installation steps

Add the lib to your composer.json, run composer require novactive/ezprotectedcontentbundle to refresh dependencies.

Then inject the bundle in the bundles.php of your application.

    Novactive\Bundle\eZProtectedContentBundle\NovaeZProtectedContentBundle::class => [ 'all'=> true ],

Add routes

_novaezprotectedcontent_routes:
    resource: '@NovaeZProtectedContentBundle/Resources/config/routing/main.yml'

Copie migration files

cp vendor/novactive/ezprotectedcontentbundle/bundle/Resources/migrations/* src/Migrations/Ibexa/migrations/
php bin/console ibexa:migrations:migrate --allow-no-migration --disable-locking -v

Install the database schema

bin/console novaezprotectedcontent:install

Varnish

This module add a cookie to unlock the contents that match it, for that reason you want to keep all the cookie that starts with PasswordProvided::COOKIE_PREFIX (i.e: protected-content-).

 // Remove all cookies besides Session ID, as JS tracker cookies and so will make the responses effectively un-cached
    if (req.http.cookie) {
        set req.http.cookie = ";" + req.http.cookie;
        set req.http.cookie = regsuball(req.http.cookie, "; +", ";");
        set req.http.cookie = regsuball(req.http.cookie, ";[ ]*(eZSESSID[^=]*|protected-content-[^=]*)=", "; \1=");
        set req.http.cookie = regsuball(req.http.cookie, ";[^ ][^;]*", "");
        set req.http.cookie = regsuball(req.http.cookie, "^[; ]+|[; ]+$", "");
    }

统计信息

  • 总下载量: 7.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 15
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-05