Skip to content
Snippets Groups Projects
Unverified Commit eb8e487d authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Add PersonUserItemPreEvent

parent 1a6c98cb
No related branches found
No related tags found
No related merge requests found
Pipeline #84213 passed with warnings
<?php
declare(strict_types=1);
namespace Dbp\Relay\BasePersonConnectorLdapBundle\Event;
use Adldap\Models\User;
use Symfony\Contracts\EventDispatcher\Event;
class PersonUserItemPreEvent extends Event
{
public const NAME = 'dbp.relay.base_person_connector_ldap_bundle.person_user_item.pre';
protected $identifier;
public function __construct(string $identifier)
{
$this->identifier = $identifier;
}
public function getIdentifier(): string
{
return $this->identifier;
}
public function setIdentifier(string $identifier): void
{
$this->identifier = $identifier;
}
}
......@@ -18,6 +18,7 @@ use Dbp\Relay\BasePersonBundle\Entity\Person;
use Dbp\Relay\BasePersonConnectorLdapBundle\Event\PersonForExternalServiceEvent;
use Dbp\Relay\BasePersonConnectorLdapBundle\Event\PersonFromUserItemPostEvent;
use Dbp\Relay\BasePersonConnectorLdapBundle\Event\PersonFromUserItemPreEvent;
use Dbp\Relay\BasePersonConnectorLdapBundle\Event\PersonUserItemPreEvent;
use Dbp\Relay\CoreBundle\API\UserSessionInterface;
use Dbp\Relay\CoreBundle\Exception\ApiError;
use Dbp\Relay\CoreBundle\Helpers\Tools as CoreTools;
......@@ -219,6 +220,10 @@ class LDAPApi implements LoggerAwareInterface, ServiceSubscriberInterface
public function getPersonUserItem(string $identifier): ?User
{
$preEvent = new PersonUserItemPreEvent($identifier);
$this->dispatcher->dispatch($preEvent, PersonUserItemPreEvent::NAME);
$identifier = $preEvent->getIdentifier();
try {
$provider = $this->getProvider();
$builder = $this->getCachedBuilder($provider);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment