From ff7484bfc7b37a0675ee0a361c48a2534abc35b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Fri, 25 Feb 2022 13:52:22 +0100 Subject: [PATCH 1/7] Switch nomenclature from eZ Platform to Ibexa --- DependencyInjection/Configuration.php | 2 +- DependencyInjection/EzCoreExtraExtension.php | 2 +- EventListener/ViewTemplateListener.php | 20 ++++++++-------- Resources/config/services.yml | 12 +++++----- Security/Voter/SimplifiedCoreVoter.php | 12 +++++----- Templating/Twig/TwigGlobalsExtension.php | 4 ++-- View/ConfigurableView.php | 12 +++++----- composer.json | 24 ++++++++++---------- 8 files changed, 44 insertions(+), 44 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 6fbcf6c..b5e5841 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -11,7 +11,7 @@ namespace Lolautruche\EzCoreExtraBundle\DependencyInjection; -use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\Configuration as SiteAccessConfiguration; +use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\Configuration as SiteAccessConfiguration; use Symfony\Component\Config\Definition\Builder\TreeBuilder; class Configuration extends SiteAccessConfiguration diff --git a/DependencyInjection/EzCoreExtraExtension.php b/DependencyInjection/EzCoreExtraExtension.php index 1e4ba81..ca76d3f 100644 --- a/DependencyInjection/EzCoreExtraExtension.php +++ b/DependencyInjection/EzCoreExtraExtension.php @@ -11,7 +11,7 @@ namespace Lolautruche\EzCoreExtraBundle\DependencyInjection; -use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor; +use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor; use Lolautruche\EzCoreExtraBundle\View\ViewParameterProviderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; diff --git a/EventListener/ViewTemplateListener.php b/EventListener/ViewTemplateListener.php index 436e864..4def553 100644 --- a/EventListener/ViewTemplateListener.php +++ b/EventListener/ViewTemplateListener.php @@ -11,14 +11,14 @@ namespace Lolautruche\EzCoreExtraBundle\EventListener; -use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParserInterface; -use eZ\Publish\API\Repository\Repository; -use eZ\Publish\Core\MVC\ConfigResolverInterface; -use eZ\Publish\Core\MVC\Symfony\Event\PreContentViewEvent; -use eZ\Publish\Core\MVC\Symfony\MVCEvents; -use eZ\Publish\Core\MVC\Symfony\View\ContentValueView; -use eZ\Publish\Core\MVC\Symfony\View\ContentView; -use eZ\Publish\Core\MVC\Symfony\View\LocationValueView; +use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParserInterface; +use Ibexa\Contracts\Core\Repository\Repository; +use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; +use Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent; +use Ibexa\Core\MVC\Symfony\MVCEvents; +use Ibexa\Core\MVC\Symfony\View\ContentValueView; +use Ibexa\Core\MVC\Symfony\View\ContentView; +use Ibexa\Core\MVC\Symfony\View\LocationValueView; use Lolautruche\EzCoreExtraBundle\Exception\MissingParameterProviderException; use Lolautruche\EzCoreExtraBundle\View\ConfigurableView; use Lolautruche\EzCoreExtraBundle\View\ExpressionLanguage; @@ -82,7 +82,7 @@ public function addParameterProvider(ViewParameterProviderInterface $provider, $ public function onPreContentView(PreContentViewEvent $event) { - /** @var \eZ\Publish\Core\MVC\Symfony\View\ContentView $view */ + /** @var \Ibexa\Core\MVC\Symfony\View\ContentView $view */ $view = $event->getContentView(); $configHash = $view->getConfigHash(); if (!isset($configHash['params']) || !is_array($configHash['params'])) { @@ -134,7 +134,7 @@ public function onPreContentView(PreContentViewEvent $event) } /** - * @param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view + * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view * @return ConfigurableView */ private function generateConfigurableView(ContentView $view) diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 1506c99..3989b18 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -4,9 +4,9 @@ services: ez_core_extra.view_template_listener: class: Lolautruche\EzCoreExtraBundle\EventListener\ViewTemplateListener arguments: - - "@ezpublish.config.resolver" - - "@ezpublish.config.dynamic_setting.parser" - - "@ezpublish.api.repository" + - "@ibexa.config.resolver" + - "@Ibexa\\Bundle\\Core\\DependencyInjection\\Configuration\\SiteAccessAware\\DynamicSettingParser" + - "@ibexa.api.repository" - "@ez_core_extra.view.expression_language" tags: @@ -16,7 +16,7 @@ services: public: false class: Lolautruche\EzCoreExtraBundle\Templating\Twig\TwigGlobalsExtension arguments: - - '@ezpublish.config.resolver' + - '@ibexa.config.resolver' tags: - { name: twig.extension } @@ -24,8 +24,8 @@ services: public: false class: Lolautruche\EzCoreExtraBundle\Security\Voter\SimplifiedCoreVoter arguments: - - "@ezpublish.security.voter.core" - - "@ezpublish.security.voter.value_object" + - "@Ibexa\\Core\\MVC\\Symfony\\Security\\Authorization\\Voter\\CoreVoter" + - "@Ibexa\\Core\\MVC\\Symfony\\Security\\Authorization\\Voter\\ValueObjectVoter" tags: - { name: "security.voter" } diff --git a/Security/Voter/SimplifiedCoreVoter.php b/Security/Voter/SimplifiedCoreVoter.php index 0ce5db0..c9c38a8 100644 --- a/Security/Voter/SimplifiedCoreVoter.php +++ b/Security/Voter/SimplifiedCoreVoter.php @@ -11,15 +11,15 @@ namespace Lolautruche\EzCoreExtraBundle\Security\Voter; -use eZ\Publish\API\Repository\Exceptions\InvalidArgumentException; -use eZ\Publish\API\Repository\Values\ValueObject; -use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute as AuthorizationAttribute; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Values\ValueObject; +use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute as AuthorizationAttribute; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; class SimplifiedCoreVoter implements VoterInterface { - const EZ_ROLE_PREFIX = 'ez:'; + const IBEXA_ROLE_PREFIX = 'ez:'; /** * @var VoterInterface @@ -39,7 +39,7 @@ public function __construct(VoterInterface $coreVoter, VoterInterface $valueObje public function supportsAttribute($attribute) { - return is_string($attribute) && stripos($attribute, static::EZ_ROLE_PREFIX) === 0; + return is_string($attribute) && stripos($attribute, static::IBEXA_ROLE_PREFIX) === 0; } public function supportsClass($class) @@ -54,7 +54,7 @@ public function vote(TokenInterface $token, $object, array $attributes) continue; } - $attribute = substr($attribute, strlen(static::EZ_ROLE_PREFIX)); + $attribute = substr($attribute, strlen(static::IBEXA_ROLE_PREFIX)); list($module, $function) = explode(':', $attribute); $attributeObject = new AuthorizationAttribute($module, $function); try { diff --git a/Templating/Twig/TwigGlobalsExtension.php b/Templating/Twig/TwigGlobalsExtension.php index a502928..1a3d072 100644 --- a/Templating/Twig/TwigGlobalsExtension.php +++ b/Templating/Twig/TwigGlobalsExtension.php @@ -11,7 +11,7 @@ namespace Lolautruche\EzCoreExtraBundle\Templating\Twig; -use eZ\Publish\Core\MVC\ConfigResolverInterface; +use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Twig\Extension\AbstractExtension; use Twig\Extension\GlobalsInterface; @@ -21,7 +21,7 @@ class TwigGlobalsExtension extends AbstractExtension implements GlobalsInterface { /** - * @var \eZ\Publish\Core\MVC\ConfigResolverInterface + * @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ private $configResolver; diff --git a/View/ConfigurableView.php b/View/ConfigurableView.php index 90042a7..63cc276 100644 --- a/View/ConfigurableView.php +++ b/View/ConfigurableView.php @@ -9,9 +9,9 @@ namespace Lolautruche\EzCoreExtraBundle\View; -use eZ\Publish\Core\MVC\Symfony\View\ContentValueView; -use eZ\Publish\Core\MVC\Symfony\View\LocationValueView; -use eZ\Publish\Core\MVC\Symfony\View\View; +use Ibexa\Core\MVC\Symfony\View\ContentValueView; +use Ibexa\Core\MVC\Symfony\View\LocationValueView; +use Ibexa\Core\MVC\Symfony\View\View; use Lolautruche\EzCoreExtraBundle\Exception\UnsupportedException; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\ControllerReference; @@ -23,7 +23,7 @@ class ConfigurableView implements View, ContentValueView, LocationValueView { /** - * @var \eZ\Publish\Core\MVC\Symfony\View\View|ContentValueView|LocationValueView + * @var \Ibexa\Core\MVC\Symfony\View\View|ContentValueView|LocationValueView */ private $innerView; @@ -162,7 +162,7 @@ public function getResponse() /** * Returns the Content. * - * @return \eZ\Publish\API\Repository\Values\Content\Content + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ public function getContent() { @@ -170,7 +170,7 @@ public function getContent() } /** - * @return \eZ\Publish\API\Repository\Values\Content\Location + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location */ public function getLocation() { diff --git a/composer.json b/composer.json index 55be535..2ad7ccb 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,17 @@ { "name": "lolautruche/ez-core-extra-bundle", - "description": "Extra sugar for building eZ Platform websites", + "description": "Extra sugar for building Ibexa websites", "require": { - "ezsystems/ezplatform-kernel": "^1.0", + "ibexa/core": "^4.0", "twig/twig": "^3.0", - "symfony/config": "^5.0", - "symfony/event-dispatcher": "^5.0", - "symfony/dependency-injection": "^5.0", - "symfony/security-core": "^5.0", - "symfony/http-foundation": "^5.0", - "symfony/http-kernel": "^5.0", - "symfony/expression-language": "^5.0", - "symfony/options-resolver": "^5.0" + "symfony/config": "^5.4", + "symfony/event-dispatcher": "^5.4", + "symfony/dependency-injection": "^5.4", + "symfony/security-core": "^5.4", + "symfony/http-foundation": "^5.4", + "symfony/http-kernel": "^5.4", + "symfony/expression-language": "^5.4", + "symfony/options-resolver": "^5.4" }, "minimum-stability": "dev", "prefer-stable": true, @@ -30,11 +30,11 @@ "mikey179/vfsstream": "^1.6.3" }, "suggest": { - "ezsystems/ezplatform-design-engine": "Design fallback mechanism for eZ Platform (previously part of EzCoreExtraBundle)" + "ibexa/design-engine": "Design fallback mechanism for Ibexa (previously part of EzCoreExtraBundle)" }, "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "4.x-dev" } } } From 0c86b3cccefd2687c31390d82a04a12a46bf6eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Thu, 17 Mar 2022 12:40:55 +0100 Subject: [PATCH 2/7] Add more renames from ez to ibexa --- README.md | 31 ++++++------------- Resources/doc/simplified_auth_checks.md | 8 ++--- Resources/doc/template_variables_injection.md | 18 +++-------- Resources/doc/view_parameters_expressions.md | 21 ++++++------- Resources/doc/view_parameters_providers.md | 16 +++++----- .../ViewTemplateListenerTest.php | 26 ++++++++-------- .../Voter/SimplifiedCoreVoterTest.php | 6 ++-- Tests/Templating/TwigGlobalsExtensionTest.php | 2 +- Tests/View/ConfigurableViewTest.php | 8 ++--- 9 files changed, 57 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index 7e101cd..ec76991 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,11 @@ [![SensioLabsInsight](https://insight.sensiolabs.com/projects/4c330566-a5a9-45c1-82a5-00d781f355a0/mini.png)](https://insight.sensiolabs.com/projects/4c330566-a5a9-45c1-82a5-00d781f355a0) [![Build Status](https://travis-ci.org/lolautruche/EzCoreExtraBundle.svg)](http://travis-ci.org/lolautruche/EzCoreExtraBundle) -Adds extra features to eZ Platform. +Adds extra features to Ibexa Platform. ## Compatibility -* `master` branch is **only compatible with eZ Platform v3** +* `master` branch is **only compatible with Ibexa Platform v4** +* `v3.x` branch is **only compatible with eZ Platform v3** * `v2.x` is **only compatible with eZ Platform v1 and v2** * `1.0` branch is compatible with both eZ Platform *and* eZ Publish 5.4/2014.11. @@ -17,7 +18,7 @@ Adds extra features to eZ Platform. This avoids you to create custom controllers when you need to add a few simple variables to your view. ```yaml - ezpublish: + ibexa: system: my_siteaccess: location_view: @@ -28,9 +29,6 @@ Adds extra features to eZ Platform. # Following keys will be injected as variables into configured template osTypes: [osx, linux, losedows] secret: %secret% - # Parameters resolved by config resolver - # See https://doc.ez.no/display/EZP/Dynamic+settings+injection - default_ttl: $content.default_ttl$ # Using a parameter provider, for more complex usecases. my_provider: {"provider": "my_param_provider"} @@ -55,17 +53,19 @@ Adds extra features to eZ Platform. * **[Simplified authorization checks](Resources/doc/simplified_auth_checks.md)** Simplifies calls to `$this->isGranted()` from inside controllers and `is_granted()` from within templates when checking - against eZ inner permission system (module/function/valueObject). + against Ibexa inner permission system (module/function/valueObject). ``` ## Requirements -EzCoreExtraBundle currently works eZ Platform v1, v2 and v3 (kernel v6, v7 and v8). +EzCoreExtraBundle currently works eZ Platform v1, v2 and v3 (kernel v6, v7 and v8), and Ibexa Platform v4. > If you're using eZ publish 5.4/2014.11 or Netgen variant, look at `1.1` branch and/or `v1.x` releases. > If you're using eZ Platform v1 or v2, look at `2.x` branch and/or `v2.x` releases. +> If you're using eZ Platform v3, look at `3.x` branch and/or `v3.x` releases. + ## Installation This bundle is available on [Packagist](https://packagist.org/packages/lolautruche/ez-core-extra-bundle). You can install it using Composer. @@ -76,20 +76,7 @@ composer require lolautruche/ez-core-extra-bundle Then add it to your application: -> `EzCoreExtraBundle` **MUST** be instanciated **AFTER** eZ bundles. - -```php -// ezpublish/EzPublishKernel.php - -public function registerBundles() -{ - $bundles = [ - // ... - new Lolautruche\EzCoreExtraBundle\EzCoreExtraBundle(), - // ... - ]; -} -``` +> `EzCoreExtraBundle` **MUST** be instanciated **AFTER** Ibexa bundles. ## Documentation See [Resources/doc/](Resources/doc) diff --git a/Resources/doc/simplified_auth_checks.md b/Resources/doc/simplified_auth_checks.md index 29910e1..eb7e48c 100644 --- a/Resources/doc/simplified_auth_checks.md +++ b/Resources/doc/simplified_auth_checks.md @@ -1,6 +1,6 @@ # Simplified authorization checks -This feature simplifies the way you check authorization with eZ inner ACL system, using +This feature simplifies the way you check authorization with Ibexa inner ACL system, using `module/function` and optionnaly a value object (e.g. a content object). Without eZCoreExtraBundle, when one want to check if a user has access to a module/function like @@ -9,8 +9,8 @@ Without eZCoreExtraBundle, when one want to check if a user has access to a modu ```php namespace Acme\Controller; -use eZ\Bundle\EzPublishCoreBundle\Controller; -use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute as AuthorizationAttribute; +use Ibexa\Bundle\Core\Controller; +use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute as AuthorizationAttribute; class MyController extends Controller { @@ -46,7 +46,7 @@ Taking the example from the introduction, it will be: ```php namespace Acme\Controller; -use eZ\Bundle\EzPublishCoreBundle\Controller; +use Ibexa\Bundle\Core\Controller; class MyController extends Controller { diff --git a/Resources/doc/template_variables_injection.md b/Resources/doc/template_variables_injection.md index 3f8cb74..6229203 100644 --- a/Resources/doc/template_variables_injection.md +++ b/Resources/doc/template_variables_injection.md @@ -17,8 +17,8 @@ Typical use cases are access to: This features adds the possibility to define Twig global variables depending on the current SiteAccess. These global variables will be available in every templates. -It also adds a [generic subscriber to `ezpublish.pre_content_view` event](https://doc.ez.no/display/EZP/Parameters+injection+in+content+views), -bound to the template selection rules, so that you can inject configured parameters in the selected view. +It also adds a generic subscriber to `ezpublish.pre_content_view` event, bound to the template selection rules, +so that you can inject configured parameters in the selected view. ## Context aware Twig global variables @@ -57,8 +57,6 @@ You can inject several types of parameters: * Plain parameters, which values are directly defined in the configuration (including arrays, hashes, booleans…) * Parameter references from the ServiceContainer (e.g. `%my.parameter%`) -* [Dynamic settings](https://doc.ez.no/display/EZP/Dynamic+settings+injection) (aka *siteaccess aware parameters*, - using `$[;[;]]$` syntax) * [Expressions](view_parameters_expressions.md) (for dynamic injection with ExpressionLanguage) * [Parameters provider services](view_parameters_providers.md) (for more dynamic injection using custom reusable services) @@ -66,22 +64,16 @@ You can inject several types of parameters: This feature would allow to configure a content/location/block view the following way: ```yaml -# ezplatform.yml -ezpublish: +ibexa: system: my_siteaccess: location_view: full: article_test: - template: "@ezdesign/full/article_test.html.twig" + template: "@ibexadesign/full/article_test.html.twig" params: osTypes: [osx, linux, losedows] secret: "%secret%" - # Parameters resolved by config resolver - # Supported syntax for parameters: $[;[;]]$ - # e.g. full syntax: $my_setting;custom_namespace;my_siteaccess$ - # See https://doc.ez.no/display/EZP/Dynamic+settings+injection - default_ttl: "$content.default_ttl$" match: Id\Location: 144 ``` @@ -98,7 +90,7 @@ The view template would then be like: {% extends "pagelayout.html.twig" %} {% block content %} -

{{ ez_render_field(content, 'title') }}

+

{{ ibexa_render_field(content, 'title') }}

Secret: {{ secret }}

diff --git a/Resources/doc/view_parameters_expressions.md b/Resources/doc/view_parameters_expressions.md index 2d016f2..d613fb6 100644 --- a/Resources/doc/view_parameters_expressions.md +++ b/Resources/doc/view_parameters_expressions.md @@ -8,14 +8,13 @@ This feature is written on top of [Symfony ExpressionLanguage component](https:/ ## Example ```yaml -# ezplatform.yml -ezpublish: +ibexa: system: my_siteaccess: location_view: full: article_test: - template: "@ezdesign/full/article_test.html.twig" + template: "@ibexadesign/full/article_test.html.twig" params: parentLocation: expression: "loadLocation(location.parentLocationId)" @@ -34,14 +33,14 @@ ezpublish: In order to build your expressions, several variables and functions are exposed ### Variables -| Variable name | Type | Description | -|------------------|-------------------------------------------------------------|---------------------------------------| -| `view` | `Lolautruche\EzCoreExtraBundle\View\ConfigurableView` | The **content view** being configured | -| `content` | `eZ\Publish\Core\Repository\Values\Content\Content` | Current content | -| `location` | `eZ\Publish\Core\Repository\Values\Content\Location` | Current location | -| `contentType` | `eZ\Publish\Core\Repository\Values\ContentType\ContentType` | ContentType of the current content | -| `configResolver` | `eZ\Publish\Core\MVC\ConfigResolverInterface` | The ConfigResolver | -| `repository` | `eZ\Publish\Core\Repository\Repository` | The content repository | +| Variable name | Type | Description | +|------------------|-----------------------------------------------------------|---------------------------------------| +| `view` | `Lolautruche\EzCoreExtraBundle\View\ConfigurableView` | The **content view** being configured | +| `content` | `Ibexa\Core\Repository\Values\Content\Content` | Current content | +| `location` | `Ibexa\Core\Repository\Values\Content\Location` | Current location | +| `contentType` | `Ibexa\Core\Repository\Values\ContentType\ContentType` | ContentType of the current content | +| `configResolver` | `Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface` | The ConfigResolver | +| `repository` | `Ibexa\Core\Repository\Repository` | The content repository | ### Functions | Function name | Description | diff --git a/Resources/doc/view_parameters_providers.md b/Resources/doc/view_parameters_providers.md index 68afa8f..0238210 100644 --- a/Resources/doc/view_parameters_providers.md +++ b/Resources/doc/view_parameters_providers.md @@ -13,7 +13,7 @@ Such services must be defined with `ez_core_extra.view_parameter_provider` tag. A Parameters provider may expose options that one can set in the view configuration to alter the service behavior. -Cherry on the cake, such services are reusable across all the content views in your eZ application. +Cherry on the cake, such services are reusable across all the content views in your Ibexa application. ## Parameters provider example @@ -26,8 +26,8 @@ author field (see exposed options). namespace AppBundle\Provider; -use eZ\Publish\API\Repository\ContentTypeService; -use eZ\Publish\API\Repository\UserService; +use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\UserService; use Lolautruche\EzCoreExtraBundle\View\ConfigurableView; use Lolautruche\EzCoreExtraBundle\View\ConfigurableViewParameterProvider; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -104,7 +104,7 @@ class MetaDataProvider extends ConfigurableViewParameterProvider services: app.metadata_provider: class: AppBundle\Provider\MetaDataProvider - arguments: ['@ezpublish.api.service.user', '@ezpublish.api.service.content_type'] + arguments: ['@ibexa.api.service.user', '@ibexa.api.service.content_type'] tags: # By default the provider alias will be the service name, but you may customize it using "alias" tag attribute. - { name: ez_core_extra.view_parameter_provider } @@ -118,18 +118,18 @@ services: autoconfigure: true AppBundle\Provider\MetaDataProvider: - arguments: ['@ezpublish.api.service.user', '@ezpublish.api.service.content_type'] + arguments: ['@ibexa.api.service.user', '@ibexa.api.service.content_type'] ``` ### View configuration ```yaml -ezpublish: +ibexa: system: my_siteaccess: location_view: full: article_test: - template: "@ezdesign/full/article_test.html.twig" + template: "@ibexadesign/full/article_test.html.twig" params: # Key is the name of the variable "namespace" in the template (see template below) metadata: @@ -149,7 +149,7 @@ ezpublish: {% extends "pagelayout.html.twig" %} {% block content %} -

{{ ez_render_field(content, 'title') }}

+

{{ ibexa_render_field(content, 'title') }}

{# Param provider is namespaced by "metadata" according to configuration #}

Author: {{ metadata.author }}

diff --git a/Tests/EventListener/ViewTemplateListenerTest.php b/Tests/EventListener/ViewTemplateListenerTest.php index 6a09f79..27bef84 100644 --- a/Tests/EventListener/ViewTemplateListenerTest.php +++ b/Tests/EventListener/ViewTemplateListenerTest.php @@ -11,15 +11,15 @@ namespace Lolautruche\EzCoreExtraBundle\Tests\EventListener; -use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParser; -use eZ\Publish\API\Repository\Repository; -use eZ\Publish\Core\MVC\ConfigResolverInterface; -use eZ\Publish\Core\MVC\Symfony\Event\PreContentViewEvent; -use eZ\Publish\Core\MVC\Symfony\MVCEvents; -use eZ\Publish\Core\MVC\Symfony\View\ContentView; -use eZ\Publish\Core\MVC\Symfony\View\View; -use eZ\Publish\Core\Repository\Values\Content\Content; -use eZ\Publish\Core\Repository\Values\Content\Location; +use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParser; +use Ibexa\Contracts\Core\Repository\Repository; +use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; +use Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent; +use Ibexa\Core\MVC\Symfony\MVCEvents; +use Ibexa\Core\MVC\Symfony\View\ContentView; +use Ibexa\Core\MVC\Symfony\View\View; +use Ibexa\Core\Repository\Values\Content\Content; +use Ibexa\Core\Repository\Values\Content\Location; use Lolautruche\EzCoreExtraBundle\EventListener\ViewTemplateListener; use Lolautruche\EzCoreExtraBundle\Exception\MissingParameterProviderException; use Lolautruche\EzCoreExtraBundle\View\ConfigurableView; @@ -30,17 +30,17 @@ class ViewTemplateListenerTest extends TestCase { /** - * @var \PHPUnit\Framework\MockObject\MockObject|\eZ\Publish\Core\MVC\ConfigResolverInterface + * @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ private $configResolver; /** - * @var \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParserInterface + * @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParserInterface */ private $dynamicSettingParser; /** - * @var \PHPUnit\Framework\MockObject\MockObject|\eZ\Publish\API\Repository\Repository + * @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Repository\Repository */ private $repository; @@ -69,7 +69,7 @@ public function testGetSubscribedEvents(): void } /** - * @return \PHPUnit\Framework\MockObject\MockObject|\eZ\Publish\Core\MVC\Symfony\View\ContentView + * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\MVC\Symfony\View\ContentView */ private function generateView() { diff --git a/Tests/Security/Voter/SimplifiedCoreVoterTest.php b/Tests/Security/Voter/SimplifiedCoreVoterTest.php index 333b7da..c3cfc44 100644 --- a/Tests/Security/Voter/SimplifiedCoreVoterTest.php +++ b/Tests/Security/Voter/SimplifiedCoreVoterTest.php @@ -11,9 +11,9 @@ namespace Lolautruche\EzCoreExtraBundle\Tests\Security\Voter; -use eZ\Publish\API\Repository\Values\ValueObject; -use eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue; -use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute; +use Ibexa\Contracts\Core\Repository\Values\ValueObject; +use Ibexa\Core\Base\Exceptions\InvalidArgumentValue; +use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use Lolautruche\EzCoreExtraBundle\Security\Voter\SimplifiedCoreVoter; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; diff --git a/Tests/Templating/TwigGlobalsExtensionTest.php b/Tests/Templating/TwigGlobalsExtensionTest.php index d64ab77..2f9fd23 100644 --- a/Tests/Templating/TwigGlobalsExtensionTest.php +++ b/Tests/Templating/TwigGlobalsExtensionTest.php @@ -11,7 +11,7 @@ namespace Lolautruche\EzCoreExtraBundle\Tests\Templating; -use eZ\Publish\Core\MVC\ConfigResolverInterface; +use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Lolautruche\EzCoreExtraBundle\Templating\Twig\TwigGlobalsExtension; use PHPUnit\Framework\TestCase; diff --git a/Tests/View/ConfigurableViewTest.php b/Tests/View/ConfigurableViewTest.php index bc6cd0d..01b3780 100644 --- a/Tests/View/ConfigurableViewTest.php +++ b/Tests/View/ConfigurableViewTest.php @@ -9,10 +9,10 @@ namespace Lolautruche\EzCoreExtraBundle\Tests\View; -use eZ\Publish\Core\MVC\Symfony\View\ContentView; -use eZ\Publish\Core\MVC\Symfony\View\View; -use eZ\Publish\Core\Repository\Values\Content\Content; -use eZ\Publish\Core\Repository\Values\Content\Location; +use Ibexa\Core\MVC\Symfony\View\ContentView; +use Ibexa\Core\MVC\Symfony\View\View; +use Ibexa\Core\Repository\Values\Content\Content; +use Ibexa\Core\Repository\Values\Content\Location; use Lolautruche\EzCoreExtraBundle\Exception\UnsupportedException; use Lolautruche\EzCoreExtraBundle\View\ConfigurableView; use PHPUnit\Framework\TestCase; From c27671507579769b38a090b41103bd0a99b2d7fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Thu, 17 Mar 2022 12:42:59 +0100 Subject: [PATCH 3/7] Replace Travis with Github Actions --- .github/workflows/tests.yml | 49 +++++++++++++++++++++++++++++++++++++ .travis.yml | 26 -------------------- README.md | 1 - 3 files changed, 49 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..1b6fa7f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,49 @@ +name: Tests + +on: + push: + branches: + - 'master' + pull_request: ~ + +jobs: + tests: + name: ${{ matrix.php }} / ${{ matrix.symfony }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: ['7.4', '8.0', '8.1'] + symfony: ['~5.4.0'] + deps: ['normal'] + include: + - php: '7.4' + symfony: '~5.4.0' + deps: 'low' + + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - run: composer --version + - run: composer validate --strict + + # Install Flex as a global dependency to enable usage of extra.symfony.require + # while keeping Flex recipes from applying + - run: composer global require --no-scripts symfony/flex + + - run: composer config extra.symfony.require ${{ matrix.symfony }} + + - + run: composer update --prefer-dist + if: ${{ matrix.deps != 'low' }} + + - + run: composer update --prefer-dist --prefer-lowest --prefer-stable + if: ${{ matrix.deps == 'low' }} + + - run: vendor/bin/phpunit --colors=always diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3b718cc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -sudo: false - -branches: - only: - - master - - /^\d+\.\d+$/ - -matrix: - include: - - php: 7.3 - env: EZ_KERNEL_VERSION=^8.0 - -install: - - phpenv config-rm xdebug.ini - - echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - composer require "ezsystems/ezpublish-kernel:${EZ_KERNEL_VERSION}" --no-update - - composer install - -script: - - php vendor/bin/phpunit diff --git a/README.md b/README.md index ec76991..4a1d726 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # EzCoreExtraBundle [![SensioLabsInsight](https://insight.sensiolabs.com/projects/4c330566-a5a9-45c1-82a5-00d781f355a0/mini.png)](https://insight.sensiolabs.com/projects/4c330566-a5a9-45c1-82a5-00d781f355a0) -[![Build Status](https://travis-ci.org/lolautruche/EzCoreExtraBundle.svg)](http://travis-ci.org/lolautruche/EzCoreExtraBundle) Adds extra features to Ibexa Platform. From 97c0e2869e03f6d5dded11d81e876cd040857ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Thu, 17 Mar 2022 12:49:35 +0100 Subject: [PATCH 4/7] Fix test --- Tests/Security/Voter/SimplifiedCoreVoterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Security/Voter/SimplifiedCoreVoterTest.php b/Tests/Security/Voter/SimplifiedCoreVoterTest.php index c3cfc44..f5d22e6 100644 --- a/Tests/Security/Voter/SimplifiedCoreVoterTest.php +++ b/Tests/Security/Voter/SimplifiedCoreVoterTest.php @@ -57,7 +57,7 @@ public function supportsAttributeProvider(): array return [ ['foo', false], ['bar', false], - [SimplifiedCoreVoter::EZ_ROLE_PREFIX.'foo:bar', true], + [SimplifiedCoreVoter::IBEXA_ROLE_PREFIX.'foo:bar', true], [new \stdClass(), false], [[], false] ]; From 8414d08dd4e4accb360f1f15e9c6ac5f44538248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Thu, 17 Mar 2022 13:05:02 +0100 Subject: [PATCH 5/7] Change voter prefix to ibexa: --- Resources/doc/simplified_auth_checks.md | 10 +++++----- Security/Voter/SimplifiedCoreVoter.php | 2 +- Tests/Security/Voter/SimplifiedCoreVoterTest.php | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Resources/doc/simplified_auth_checks.md b/Resources/doc/simplified_auth_checks.md index eb7e48c..fe71543 100644 --- a/Resources/doc/simplified_auth_checks.md +++ b/Resources/doc/simplified_auth_checks.md @@ -38,7 +38,7 @@ In order to check access for a `module`/`function` pair, instead of instantiatin object, just use the following syntax: ``` -ez:: +ibexa:: ``` Taking the example from the introduction, it will be: @@ -53,10 +53,10 @@ class MyController extends Controller public function fooAction() { // ... - $accessGranted = $this->isGranted('ez:content:read'); + $accessGranted = $this->isGranted('ibexa:content:read'); // Or with an actual content - $accessGranted = $this->isGranted('ez:content:read', $myContent); + $accessGranted = $this->isGranted('ibexa:content:read', $myContent); } } ``` @@ -64,10 +64,10 @@ class MyController extends Controller In a template, the syntax will be: ```jinja -{% set accessGranted = is_granted('ez:content:read') %} +{% set accessGranted = is_granted('ibexa:content:read') %} {# Or with an actual content #} -{% set accessGranted = is_granted('ez:content:read', my_content) %} +{% set accessGranted = is_granted('ibexa:content:read', my_content) %} ``` Et voilĂ  :-) diff --git a/Security/Voter/SimplifiedCoreVoter.php b/Security/Voter/SimplifiedCoreVoter.php index c9c38a8..6712f5b 100644 --- a/Security/Voter/SimplifiedCoreVoter.php +++ b/Security/Voter/SimplifiedCoreVoter.php @@ -19,7 +19,7 @@ class SimplifiedCoreVoter implements VoterInterface { - const IBEXA_ROLE_PREFIX = 'ez:'; + const IBEXA_ROLE_PREFIX = 'ibexa:'; /** * @var VoterInterface diff --git a/Tests/Security/Voter/SimplifiedCoreVoterTest.php b/Tests/Security/Voter/SimplifiedCoreVoterTest.php index f5d22e6..fb3dea4 100644 --- a/Tests/Security/Voter/SimplifiedCoreVoterTest.php +++ b/Tests/Security/Voter/SimplifiedCoreVoterTest.php @@ -75,7 +75,7 @@ public function testVoteGrantedNoValueObject(): void { $token = $this->createMock(TokenInterface::class); $object = null; - $attribute = 'ez:foo:bar'; + $attribute = 'ibexa:foo:bar'; $attributeObject = new Attribute('foo', 'bar'); $this->coreVoter ->expects($this->once()) @@ -96,7 +96,7 @@ public function testVoteDeniedNoValueObject(): void { $token = $this->createMock(TokenInterface::class); $object = null; - $attribute = 'ez:foo:bar'; + $attribute = 'ibexa:foo:bar'; $attributeObject = new Attribute('foo', 'bar'); $this->coreVoter ->expects($this->once()) @@ -117,7 +117,7 @@ public function testVoteExceptionNoValueObject(): void { $token = $this->createMock(TokenInterface::class); $object = null; - $attribute = 'ez:foo:bar'; + $attribute = 'ibexa:foo:bar'; $attributeObject = new Attribute('foo', 'bar'); $this->coreVoter ->expects($this->once()) @@ -138,7 +138,7 @@ public function testVoteGrantedWithValueObject(): void { $token = $this->createMock(TokenInterface::class); $object = $this->createMock(ValueObject::class); - $attribute = 'ez:foo:bar'; + $attribute = 'ibexa:foo:bar'; $attributeObject = new Attribute('foo', 'bar', ['valueObject' => $object]); $this->valueObjectVoter ->expects($this->once()) @@ -159,7 +159,7 @@ public function testVoteDeniedWithValueObject(): void { $token = $this->createMock(TokenInterface::class); $object = $this->createMock(ValueObject::class); - $attribute = 'ez:foo:bar'; + $attribute = 'ibexa:foo:bar'; $attributeObject = new Attribute('foo', 'bar', ['valueObject' => $object]); $this->valueObjectVoter ->expects($this->once()) @@ -180,7 +180,7 @@ public function testVoteExceptionWithValueObject(): void { $token = $this->createMock(TokenInterface::class); $object = $this->createMock(ValueObject::class); - $attribute = 'ez:foo:bar'; + $attribute = 'ibexa:foo:bar'; $attributeObject = new Attribute('foo', 'bar', ['valueObject' => $object]); $this->valueObjectVoter ->expects($this->once()) From 0062669bf8fbccbf6375824f632abd1b49eedf33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Fri, 18 Mar 2022 13:59:36 +0100 Subject: [PATCH 6/7] SensioInsight does not exist any more --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 4a1d726..f0bd773 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # EzCoreExtraBundle -[![SensioLabsInsight](https://insight.sensiolabs.com/projects/4c330566-a5a9-45c1-82a5-00d781f355a0/mini.png)](https://insight.sensiolabs.com/projects/4c330566-a5a9-45c1-82a5-00d781f355a0) - Adds extra features to Ibexa Platform. ## Compatibility From ead6c3ea46bd3e0ad70df8c29b9bdf28876fc448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Fri, 18 Mar 2022 14:03:23 +0100 Subject: [PATCH 7/7] Add upgrade doc --- UPGRADE-4.0.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 UPGRADE-4.0.md diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md new file mode 100644 index 0000000..838ead5 --- /dev/null +++ b/UPGRADE-4.0.md @@ -0,0 +1,21 @@ +# UPGRADE FROM 3.x to 4.0 + +* Support for eZ Platform 3.x has been dropped (and with it support for PHP < 7.4 and Symfony < 5.4) + +* Renamed the prefix for simplified role check from `ez:` to `ibexa:` + + **Before** + + ``` + {% if is_granted('ez:user:register') %} + ... + {% endif %} + ``` + + **After** + + ``` + {% if is_granted('ibexa:user:register') %} + ... + {% endif %} + ```