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

Legacy Signal Slot missing for CreateUserSignal

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • Customer request, 5.4.12
    • 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)

      1. Create new eZ Publish installation.
      2. In the Legacy Admin navigate to "User accounts">"Users">"Editors". Verify that the Sub items count there equals 0.
      3. 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));
            }
        }
        
      4. 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)

      1. Create new eZ Publish installation.
      2. 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.
      3. In the Legacy Admin navigate to "User accounts"->"Users".
      4. 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jacek.foremski-obsolete@ez.no Jacek Foremski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: