Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
auth
Commits
e651370e
Commit
e651370e
authored
Jul 08, 2013
by
Bertrand Gauthier
Browse files
Utilisation du nouveau service d'accès aux individus LDAP : mapper Ldap.
parent
56355cbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/UnicaenAuth/Authentication/Storage/Ldap.php
View file @
e651370e
...
...
@@ -3,7 +3,7 @@
namespace
UnicaenAuth\Authentication\Storage
;
use
UnicaenApp\Entity\Ldap\People
;
use
UnicaenApp\
Service
\Ldap\People
as
LdapPeople
Service
;
use
UnicaenApp\
Mapper
\Ldap\People
as
LdapPeople
Mapper
;
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 LdapPeople
Service
* @var LdapPeople
Mapper
*/
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 LdapPeople
Service
* @return LdapPeople
Mapper
*/
public
function
getMapper
()
{
if
(
null
===
$this
->
mapper
)
{
$this
->
mapper
=
$this
->
getServiceManager
()
->
get
(
'ldap_people_
service'
)
->
getM
apper
(
);
$this
->
mapper
=
$this
->
getServiceManager
()
->
get
(
'ldap_people_
m
apper
'
);
}
return
$this
->
mapper
;
}
...
...
@@ -150,10 +152,10 @@ class Ldap implements Storage\StorageInterface, ServiceManagerAwareInterface
/**
* setMapper
*
* @param LdapPeople
Service
$mapper
* @param LdapPeople
Mapper
$mapper
* @return Ldap
*/
public
function
setMapper
(
LdapPeople
Service
$mapper
)
public
function
setMapper
(
LdapPeople
Mapper
$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
;
}
/**
...
...
tests/UnicaenAuthTest/Authentication/Storage/LdapTest.php
View file @
e651370e
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment