Details
-
Bug
-
Resolution: Fixed
-
High
-
5.1
-
None
Description
Using the API to add a limitation based on subtree to a role fails, with InvalidArgumentException
steps to reproduce:
- execute the following command
$repository = $this->getContainer()->get( 'ezpublish.api.repository' ); $repository->setCurrentUser( $repository->getUserService()->loadUser( 14 ) ); $roleService = $repository->getRoleService(); $roleCreate = $roleService->newRoleCreateStruct( "testrole" ); $role = $roleService->createRole( $roleCreate ); $roleService->newPolicyCreateStruct( "content", "read" ); $policyStruct->addLimitation( new SubtreeLimitation, array( "limitationValues" => array( "/1/2/") ) ); $roleService->addPolicy( $role, $policyStruct );
- the command will fail with:
[eZ\Publish\Core\Base\Exceptions\InvalidArgumentException] Argument 'limitations' is invalid: Some validations did not validate: array ( 'Subtree' => array ( 0 => eZ\Publish\Core\FieldType\ValidationError::__set_state(array( 'singular' => 'limitationValues[%key%] => \'%value%\' does not exist in the backend :: /1/2/ :: ', 'plural' => NULL, 'values' => array ( 'value' => '/1/2/', 'key' => 0, ), )), ), )
Attachments
Issue Links
- testing discovered
-
EZP-21703 RoleService does not validate Limitations in assignRoleToUser() and assignRoleToUserGroup() methods
- Closed