Commit e651370e authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Utilisation du nouveau service d'accès aux individus LDAP : mapper Ldap.

parent 56355cbe
......@@ -3,7 +3,7 @@
namespace UnicaenAuth\Authentication\Storage;
use UnicaenApp\Entity\Ldap\People;
use UnicaenApp\Service\Ldap\People as LdapPeopleService;
use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper;
use UnicaenAuth\Options\ModuleOptions;
use Zend\Authentication\Exception\InvalidArgumentException;
use Zend\Authentication\Storage;
......@@ -24,7 +24,7 @@ class Ldap implements Storage\StorageInterface, ServiceManagerAwareInterface
protected $storage;
/**
* @var LdapPeopleService
* @var LdapPeopleMapper
*/
protected $mapper;
......@@ -94,6 +94,7 @@ class Ldap implements Storage\StorageInterface, ServiceManagerAwareInterface
{
$this->resolvedIdentity = null;
$this->getStorage()->write($contents);
return $this;
}
/**
......@@ -106,6 +107,7 @@ class Ldap implements Storage\StorageInterface, ServiceManagerAwareInterface
{
$this->resolvedIdentity = null;
$this->getStorage()->clear();
return $this;
}
/**
......@@ -137,12 +139,12 @@ class Ldap implements Storage\StorageInterface, ServiceManagerAwareInterface
/**
* getMapper
*
* @return LdapPeopleService
* @return LdapPeopleMapper
*/
public function getMapper()
{
if (null === $this->mapper) {
$this->mapper = $this->getServiceManager()->get('ldap_people_service')->getMapper();
$this->mapper = $this->getServiceManager()->get('ldap_people_mapper');
}
return $this->mapper;
}
......@@ -150,10 +152,10 @@ class Ldap implements Storage\StorageInterface, ServiceManagerAwareInterface
/**
* setMapper
*
* @param LdapPeopleService $mapper
* @param LdapPeopleMapper $mapper
* @return Ldap
*/
public function setMapper(LdapPeopleService $mapper)
public function setMapper(LdapPeopleMapper $mapper)
{
$this->mapper = $mapper;
return $this;
......@@ -178,6 +180,7 @@ class Ldap implements Storage\StorageInterface, ServiceManagerAwareInterface
public function setServiceManager(ServiceManager $serviceManager)
{
$this->serviceManager = $serviceManager;
return $this;
}
/**
......@@ -186,6 +189,7 @@ class Ldap implements Storage\StorageInterface, ServiceManagerAwareInterface
public function setOptions(ModuleOptions $options)
{
$this->options = $options;
return $this;
}
/**
......
......@@ -30,10 +30,8 @@ class LdapTest extends PHPUnit_Framework_TestCase
$this->mapper = $mapper = $this->getMock('UnicaenApp\Service\Ldap\People', array('findOneByUsername'));
$this->serviceManager = new ServiceManager();
$this->serviceManager->setFactory('ldap_people_service', function() use ($mapper) {
$service = new \UnicaenApp\Service\Ldap\People();
$service->setMapper($mapper);
return $service;
$this->serviceManager->setFactory('ldap_people_mapper', function() use ($mapper) {
return $mapper;
});
$this->serviceManager->setFactory('unicaen-auth_module_options', function() use ($options) {
return $options;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment