New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New SiteAccessAware Repository layer #1966

Closed
wants to merge 1 commit into
base: master
from

Conversation

3 participants
@Nattfarinn
Contributor

Nattfarinn commented Apr 24, 2017

Issue: https://jira.ez.no/browse/EZP-27429

Creates a new optional api layer that injects language parameters for you wherever this is applicable, this is meant to be switched to be the default for 2.0 (kernel 7.0), but most likely not for REST (TBD separately from this).

Example

Example builds upon work being done in #2002

Instead of:

$content = $this->contentService->loadContent(
    42,
    $this->configResolver->getParameter('languages')
);

$name = $content->getVersionInfo()->getName();
$value = $content->getFieldValue('body')

We'll get:

$content = $this->contentService->loadContent(42);
$name = $content->getVersionInfo()->getName();
$value = $content->getFieldValue('body')

Todo

  • Update for #2002 if / once that has reached approved status
  • CS
  • Test updates

PR History

Replaced: #1932

Layer stripped of any additional features. It's just top-layer that fills $languages where it's possible with siteaccess language list, but does not overwrite languages specified by user.

@Nattfarinn Nattfarinn requested review from andrerom and alongosz Apr 24, 2017

@ezrobot

This comment has been minimized.

Show comment
Hide comment
@ezrobot

ezrobot Apr 24, 2017

Contributor

Tool version : PHP CS Fixer 2.1.2 by Fabien Potencier and Dariusz Ruminski
Command executed php-cs-fixer --dry-run --diff -v fix
This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below:

You are running php-cs-fixer with xdebug enabled. This has a major impact on runtime performance.
Loaded config default from "/jenkins/jenkins.std/jobs/PAPI-Pull-Request-code-sniffer/workspace/.php_cs".
Using cache file ".php_cs.cache".
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS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SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
Legend: ?-unknown, I-invalid file syntax, file ignored, S-Skipped, .-no changes, F-fixed, E-error
   1) eZ/Publish/Core/Repository/SiteAccessAware/TrashService.php (phpdoc_summary)
      ---------- begin diff ----------
--- Original
+++ New
@@ @@
     /**
-     * Language resolver
+     * Language resolver.
      *
      * @var LanguageResolver
      */
     protected $languageResolver;

     /**
      * Constructor.
      *
      * Construct service object from aggregated service
      *
      * @param \eZ\Publish\API\Repository\TrashService $service
      * @param LanguageResolver $languageResolver
      */
     public function __construct(
         TrashServiceInterface $service,
         LanguageResolver $languageResolver
     ) {
         $this->service = $service;
         $this->languageResolver = $languageResolver;
     }

     /**
      * Loads a trashed location object from its $id.
      *
      * Note that $id is identical to original location, which has been previously trashed
      *
      * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read the trashed location
      * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the location with the given id does not exist
      *
      * @param mixed $trashItemId
      *
      * @return \eZ\Publish\API\Repository\Values\Content\TrashItem
      */
     public function loadTrashItem($trashItemId)
     {
         return $this->service->loadTrashItem($trashItemId);
     }

     /**
      * Sends $location and all its children to trash and returns the corresponding trash item.
      *
      * Content is left untouched.
      *
      * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to trash the given location
      *
      * @param \eZ\Publish\API\Repository\Values\Content\Locati(...)

NOTICE : Report truncated to 5Kb

Contributor

ezrobot commented Apr 24, 2017

Tool version : PHP CS Fixer 2.1.2 by Fabien Potencier and Dariusz Ruminski
Command executed php-cs-fixer --dry-run --diff -v fix
This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below:

You are running php-cs-fixer with xdebug enabled. This has a major impact on runtime performance.
Loaded config default from "/jenkins/jenkins.std/jobs/PAPI-Pull-Request-code-sniffer/workspace/.php_cs".
Using cache file ".php_cs.cache".
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS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SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
Legend: ?-unknown, I-invalid file syntax, file ignored, S-Skipped, .-no changes, F-fixed, E-error
   1) eZ/Publish/Core/Repository/SiteAccessAware/TrashService.php (phpdoc_summary)
      ---------- begin diff ----------
--- Original
+++ New
@@ @@
     /**
-     * Language resolver
+     * Language resolver.
      *
      * @var LanguageResolver
      */
     protected $languageResolver;

     /**
      * Constructor.
      *
      * Construct service object from aggregated service
      *
      * @param \eZ\Publish\API\Repository\TrashService $service
      * @param LanguageResolver $languageResolver
      */
     public function __construct(
         TrashServiceInterface $service,
         LanguageResolver $languageResolver
     ) {
         $this->service = $service;
         $this->languageResolver = $languageResolver;
     }

     /**
      * Loads a trashed location object from its $id.
      *
      * Note that $id is identical to original location, which has been previously trashed
      *
      * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read the trashed location
      * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the location with the given id does not exist
      *
      * @param mixed $trashItemId
      *
      * @return \eZ\Publish\API\Repository\Values\Content\TrashItem
      */
     public function loadTrashItem($trashItemId)
     {
         return $this->service->loadTrashItem($trashItemId);
     }

     /**
      * Sends $location and all its children to trash and returns the corresponding trash item.
      *
      * Content is left untouched.
      *
      * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to trash the given location
      *
      * @param \eZ\Publish\API\Repository\Values\Content\Locati(...)

NOTICE : Report truncated to 5Kb

@andrerom andrerom referenced this pull request May 23, 2017

Merged

[WIP] 7.0 kernel branch #1875

1 of 3 tasks complete

@andrerom andrerom referenced this pull request Aug 4, 2017

Merged

EZP-27429: Optional SiteAccessAware Repository layer #2064

5 of 5 tasks complete
@andrerom

This comment has been minimized.

Show comment
Hide comment
@andrerom

andrerom Aug 4, 2017

Member

Closing in favor of #2064

Member

andrerom commented Aug 4, 2017

Closing in favor of #2064

@andrerom andrerom closed this Aug 4, 2017

andrerom added a commit that referenced this pull request Jan 4, 2018

andrerom added a commit that referenced this pull request Jan 15, 2018

andrerom added a commit that referenced this pull request Jun 4, 2018

andrerom added a commit that referenced this pull request Jun 4, 2018

andrerom added a commit that referenced this pull request Jun 6, 2018

andrerom added a commit that referenced this pull request Jun 16, 2018

andrerom added a commit that referenced this pull request Jun 25, 2018

lserwatka added a commit that referenced this pull request Jun 27, 2018

EZP-27429: Optional SiteAccessAware Repository layer (#2064)
* [REST] Forward BC to make sure all languages are loaded

* [Tests] Add testing of the SiteAccessAware Repository

* New SiteAccessAware Repository layer

Based on work done in #1966

* Fix errror about missing class (loading order?)

* CS

* Add missing coreLoader in EzPublishCoreExtension

* Update PR

* Change ContentViewBuilder, Param Converters and relevant Twig helpers to use SiteAccessAware Repo

* fix review comments

* Remove RoleService which atm has no logic (re-add when we add prioritized languages there)

* Move LanguageResolver into own namespace and fix phpdoc to use FQCN

* Enable missing test coverage

* Update language args phpdoc on UrlAliasService

* [yml] Fixed wrong usage of inner_repository in siteaccessaware.repository

ezrobot pushed a commit to ezsystems/ezpublish-spi that referenced this pull request Jun 27, 2018

EZP-27429: Optional SiteAccessAware Repository layer (#2064)
* [REST] Forward BC to make sure all languages are loaded

* [Tests] Add testing of the SiteAccessAware Repository

* New SiteAccessAware Repository layer

Based on work done in ezsystems/ezpublish-kernel#1966

* Fix errror about missing class (loading order?)

* CS

* Add missing coreLoader in EzPublishCoreExtension

* Update PR

* Change ContentViewBuilder, Param Converters and relevant Twig helpers to use SiteAccessAware Repo

* fix review comments

* Remove RoleService which atm has no logic (re-add when we add prioritized languages there)

* Move LanguageResolver into own namespace and fix phpdoc to use FQCN

* Enable missing test coverage

* Update language args phpdoc on UrlAliasService

* [yml] Fixed wrong usage of inner_repository in siteaccessaware.repository

ezrobot pushed a commit to ezsystems/ezpublish-api that referenced this pull request Jun 27, 2018

EZP-27429: Optional SiteAccessAware Repository layer (#2064)
* [REST] Forward BC to make sure all languages are loaded

* [Tests] Add testing of the SiteAccessAware Repository

* New SiteAccessAware Repository layer

Based on work done in ezsystems/ezpublish-kernel#1966

* Fix errror about missing class (loading order?)

* CS

* Add missing coreLoader in EzPublishCoreExtension

* Update PR

* Change ContentViewBuilder, Param Converters and relevant Twig helpers to use SiteAccessAware Repo

* fix review comments

* Remove RoleService which atm has no logic (re-add when we add prioritized languages there)

* Move LanguageResolver into own namespace and fix phpdoc to use FQCN

* Enable missing test coverage

* Update language args phpdoc on UrlAliasService

* [yml] Fixed wrong usage of inner_repository in siteaccessaware.repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment