<?php declare(strict_types=1);
namespace Iiot\CityUser;
use Doctrine\DBAL\DBALException;
use ErrorException;
use Iiot\CityUser\Service\ActivationService;
use Shopware\Core\Framework\DataAbstractionLayer\Exception\InconsistentCriteriaIdsException;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
class CityUser extends Plugin
{
/**
* @param InstallContext $installContext
*/
public function install(InstallContext $installContext): void
{
parent::install($installContext);
}
/**
* @param UninstallContext $uninstallContext
* @throws ErrorException
*/
public function uninstall(UninstallContext $uninstallContext): void
{
parent::uninstall($uninstallContext);
}
/**
* @param ActivateContext $activateContext
*/
public function activate(ActivateContext $activateContext): void
{
$activationService = new ActivationService($activateContext, $this->container);
$activationService->activate();
parent::activate($activateContext);
}
/**
* @param DeactivateContext $deactivateContext
* @throws InconsistentCriteriaIdsException
*/
public function deactivate(DeactivateContext $deactivateContext): void
{
parent::deactivate($deactivateContext);
}
public function enrichPrivileges(): array
{
return [
'users_and_permissions.viewer' => [
'city_user:read',
],
'users_and_permissions.editor' => [
'city_user:create',
'city_user:update',
'city_user:delete',
],
];
}
}