custom/static-plugins/CioApprovalThreshold/src/Subscriber/CustomerProfileRolesSubscriber.php line 25

Open in your IDE?
  1. <?php
  2. namespace CioApprovalThreshold\Subscriber;
  3. use Shopware\Storefront\Event\StorefrontRenderEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use CioCustomerPermissionGroups\Event\CustomerAclRolesEvent;
  6. use CioCustomerPermissionGroups\Service\CheckCustomerPermissionsService;
  7. class CustomerProfileRolesSubscriber implements EventSubscriberInterface
  8. {
  9.     public function __construct()
  10.     {
  11.     }
  12.     public static function getSubscribedEvents(): array
  13.     {
  14.         // Return the events to listen to as array like this:  <event to listen to> => <method to execute>
  15.         return [
  16.             CustomerAclRolesEvent::class => 'onCustomerAclRolesEvent',
  17.             // StorefrontRenderEvent::class => 'onStorefrontRenderEvent'
  18.         ];
  19.     }
  20.     public function onCustomerAclRolesEvent(CustomerAclRolesEvent $event)
  21.     {
  22.         // add all in this plugin used customer acl roles
  23.         $event->addRoles([
  24.             [
  25.                 'title' => 'ACCOUNT_ORDERS_CAN_SWITCH_PAYMENT_METHOD',
  26.                 'description' => 'Kunde kann Profildaten im Kundenaccount pflegen.'
  27.             ]
  28.         ]);
  29.     }
  30.     public function onStorefrontRenderEvent(StorefrontRenderEvent $event)
  31.     {
  32.         //dd($this->checkCustomerPermissionsService->check($event->getSalesChannelContext()->getCustomer(), 'perm_allow_create_budget', $event->getContext()));
  33.     }
  34. }