custom/plugins/cityuser/src/CityUser.php line 15

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Iiot\CityUser;
  3. use Doctrine\DBAL\DBALException;
  4. use ErrorException;
  5. use Iiot\CityUser\Service\ActivationService;
  6. use Shopware\Core\Framework\DataAbstractionLayer\Exception\InconsistentCriteriaIdsException;
  7. use Shopware\Core\Framework\Plugin;
  8. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  9. use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
  10. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  11. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  12. class CityUser extends Plugin
  13. {
  14.     /**
  15.      * @param InstallContext $installContext
  16.      */
  17.     public function install(InstallContext $installContext): void
  18.     {
  19.         parent::install($installContext);
  20.     }
  21.     /**
  22.      * @param UninstallContext $uninstallContext
  23.      * @throws ErrorException
  24.      */
  25.     public function uninstall(UninstallContext $uninstallContext): void
  26.     {
  27.         parent::uninstall($uninstallContext);
  28.     }
  29.     /**
  30.      * @param ActivateContext $activateContext
  31.      */
  32.     public function activate(ActivateContext $activateContext): void
  33.     {
  34.         $activationService = new ActivationService($activateContext$this->container);
  35.         $activationService->activate();
  36.         parent::activate($activateContext);
  37.     }
  38.     /**
  39.      * @param DeactivateContext $deactivateContext
  40.      * @throws InconsistentCriteriaIdsException
  41.      */
  42.     public function deactivate(DeactivateContext $deactivateContext): void
  43.     {
  44.         parent::deactivate($deactivateContext);
  45.     }
  46.     public function enrichPrivileges(): array
  47.     {
  48.         return [
  49.             'users_and_permissions.viewer' => [
  50.                 'city_user:read',
  51.             ],
  52.             'users_and_permissions.editor' => [
  53.                 'city_user:create',
  54.                 'city_user:update',
  55.                 'city_user:delete',
  56.             ],
  57.         ];
  58.     }
  59. }