Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-25014

Impossible to update a policy with no limitations

    Details

      Description

      Using public API, when updating a policy without limitations, following exception is thrown:

      Catchable Fatal Error: Argument 2 passed to eZ\Publish\Core\Persistence\Legacy\User\Role\Gateway\ExceptionConversion::addPolicyLimitations() must be of the type array, string given, called in /Users/lolautruche/workspace/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/User/Handler.php on line 443
      

      This is because when there is no limitations, limitations property of SPI policy is *, as documented in \eZ\Publish\SPI\Persistence\User\Policy:

          /**
           * Array of policy limitations, which is just a random hash map.
           *
           * The limitation array may look like:
           * <code>
           *  array(
           *      'Subtree' => array(
           *          '/1/2/',
           *          '/1/4/',
           *      ),
           *      'Foo' => array( 'Bar' ),
           *      …
           *  )
           * </code>
           *
           * Where the keys are the limitation identifiers, and the respective values
           * are an array of limitation values
           *
           * @var array|string If string, then only the value '*' is allowed, meaning all limitations.
           *                   Can not be a empty array as '*' should be used in this case.
           */
          public $limitations;
      

      Legacy storage engine doesn't take this case into account.

      *Note*: This occurs using RoleService::updatePolicy() and RoleService::updatePolicyByRoleDraft().

        Issue Links

          Activity

          Show
          Jérôme Vieilledent (Inactive) added a comment - PR: https://github.com/ezsystems/ezpublish-kernel/pull/1482
          Show
          Jérôme Vieilledent (Inactive) added a comment - Fixed in master: https://github.com/ezsystems/ezpublish-kernel/commit/570e25c198aa6199a237f7aecfbe67d6e9e80237
          Hide
          Miguel das Neves Jacinto (Inactive) added a comment -

          QA Approved on:
          master, 5.4 and 5.3

          Show
          Miguel das Neves Jacinto (Inactive) added a comment - QA Approved on: master, 5.4 and 5.3

            People

            • Assignee:
              Unassigned
              Reporter:
              Jérôme Vieilledent (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: