Details
-
Bug
-
Resolution: Fixed
-
High
-
5.4.11
-
None
-
None
Description
Currently, there is no Legacy Signal Slot that would work with CreateUserSignal.
This affects at least two things if the Public PHP API is used to create a User:
- Sub items list count for Users in the User group (in Legacy Admin) is showing the wrong value. This happens because Legacy cache is not cleared properly.
- The Users created via Public PHP API cannot be found using the search box in Legacy Admin. This happens because registerSearchObject method from ezpublish_legacy\kernel\content\ezcontentoperationcollection.php file is not called. It is responsible for registering the object in the search engine.
There exist a similar Slot to handle UpdateUserSignal: https://github.com/ezsystems/ezpublish-kernel-ee/blob/5.4/eZ/Publish/Core/SignalSlot/Slot/LegacyUpdateUserSlot.php. The solution should most probably involve creating similar Slot for CreateUserSignal.
Steps to reproduce (Sub items list count)
- Create new eZ Publish installation.
- In the Legacy Admin navigate to "User accounts">"Users">"Editors". Verify that the Sub items count there equals 0.
- Run the following command (also provided as an attachment to this ticket). It creates a new User using Public PHP API inside "Editors" group.
<?php namespace AppBundle\Command; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class TestCommand extends ContainerAwareCommand { protected function configure() { $this ->setName('app:test_command'); } protected function execute(InputInterface $input, OutputInterface $output) { $repository = $this->getContainer()->get('ezpublish.api.repository'); $repository->setCurrentUser($repository->getUserService()->loadUserByLogin('admin')); $contentTypeService = $repository->getContentTypeService(); $userType = $contentTypeService->loadContentTypeByIdentifier('user'); $userService = $repository->getUserService(); $userCreateStruct = $userService->newUserCreateStruct('test@example.com', "test@example.com", "password01", 'eng-GB', $userType); $userCreateStruct->setField('first_name', "firstName"); $userCreateStruct->setField('last_name', "lastName"); $userGroup = $userService->loadUserGroup(13); $repository->getUserService()->createUser($userCreateStruct, array($userGroup)); } }
- In the Legacy Admin navigate again to "User acounts">"Users">"Editors". The Sub items count there will still equal to 0 and it should equal to 1.
Steps to reproduce (Search engine)
- Create new eZ Publish installation.
- Run the command from the other steps to reproduce (also provided as an attachment to this ticket). It creates a new User using Public PHP API inside "Editors" group. There is no need to run it twice if you have already done it.
- In the Legacy Admin navigate to "User accounts"->"Users".
- Try searching for the "firstName" using the search box in the top right corner. Nothing will be found, even though the freshly created user should be found.