Commit 16f83eac authored by Bertrand Gauthier's avatar Bertrand Gauthier

Merge branch 'zf-3.x' into develop

parents 2ed36d74 6973a6e4
Pipeline #5254 failed with stage
in 12 seconds
...@@ -90,7 +90,7 @@ class Module implements AutoloaderProviderInterface, ConfigProviderInterface, Se ...@@ -90,7 +90,7 @@ class Module implements AutoloaderProviderInterface, ConfigProviderInterface, Se
*/ */
private function reconfigureRoutesForAuth(ServiceLocatorInterface $sl) private function reconfigureRoutesForAuth(ServiceLocatorInterface $sl)
{ {
/* @var $router \Zend\Mvc\Router\Http\TreeRouteStack */ /* @var $router \Zend\Router\Http\TreeRouteStack */
$router = $sl->get('router'); $router = $sl->get('router');
// si l'auth CAS est activée, modif de la route de connexion pour zapper le formulaire d'auth maison. // si l'auth CAS est activée, modif de la route de connexion pour zapper le formulaire d'auth maison.
...@@ -118,7 +118,21 @@ class Module implements AutoloaderProviderInterface, ConfigProviderInterface, Se ...@@ -118,7 +118,21 @@ class Module implements AutoloaderProviderInterface, ConfigProviderInterface, Se
public function getServiceConfig() public function getServiceConfig()
{ {
return [ return [
//========== repris du module zf-commons/zfc-user-doctrine-orm abandonné =========
'aliases' => array(
'zfcuser_doctrine_em' => 'Doctrine\ORM\EntityManager',
),
//===========================================
'factories' => [ 'factories' => [
//========== repris du module zf-commons/zfc-user-doctrine-orm abandonné =========
'zfcuser_module_options' => function ($sm) {
$config = $sm->get('Configuration');
return new Options\ModuleOptions(isset($config['zfcuser']) ? $config['zfcuser'] : array());
},
//===========================================
// verrue pour forcer le label de l'identifiant qqsoit l'options 'auth_identity_fields' // verrue pour forcer le label de l'identifiant qqsoit l'options 'auth_identity_fields'
'zfcuser_login_form' => function ($sm) { 'zfcuser_login_form' => function ($sm) {
$options = $sm->get('zfcuser_module_options'); $options = $sm->get('zfcuser_module_options');
......
...@@ -8,18 +8,16 @@ ...@@ -8,18 +8,16 @@
} }
], ],
"require": { "require": {
"unicaen/app": "^1.3", "unicaen/app": "dev-zf-3.x",
"zf-commons/zfc-user-doctrine-orm": ">=0.1", "unicaen/bjy-authorize": "dev-zf-3.x",
"jasig/phpcas": ">=1.3.3", "jasig/phpcas": "^1.3",
"bjyoungblood/bjy-authorize": ">=1.4", "ramsey/uuid": "^3.7"
"ramsey/uuid": "^3.7",
"beberlei/assert": "^2.9"
}, },
"require-dev": { "require-dev": {
"phpunit/PHPUnit": ">=3.7" "phpunit/phpunit": "^5.6"
}, },
"autoload": { "autoload": {
"psr-0": { "psr-0": {
"UnicaenAuth": "src/", "UnicaenAuth": "src/",
"UnicaenAuthTest": "tests/" "UnicaenAuthTest": "tests/"
}, },
......
This diff is collapsed.
<?php <?php
use UnicaenAuth\Authentication\Storage\DbFactory;
use UnicaenAuth\Authentication\Storage\LdapFactory;
use UnicaenAuth\Authentication\Storage\ShibFactory;
use UnicaenAuth\Controller\AuthControllerFactory; use UnicaenAuth\Controller\AuthControllerFactory;
use UnicaenAuth\Controller\DroitsControllerFactory;
use UnicaenAuth\Controller\UtilisateurControllerFactory;
use UnicaenAuth\Form\Droits\RoleFormFactory;
use UnicaenAuth\Guard\PrivilegeControllerFactory;
use UnicaenAuth\Guard\PrivilegeRouteFactory;
use UnicaenAuth\Provider\Rule\PrivilegeRuleProviderFactory;
use UnicaenAuth\Service\ShibService; use UnicaenAuth\Service\ShibService;
use UnicaenAuth\Service\ShibServiceFactory; use UnicaenAuth\Service\ShibServiceFactory;
use UnicaenAuth\Service\UserContextFactory; use UnicaenAuth\Service\UserContextFactory;
use UnicaenAuth\Service\UserFactory;
use UnicaenAuth\Service\UserMapperFactory; use UnicaenAuth\Service\UserMapperFactory;
use UnicaenAuth\View\Helper\LdapConnectViewHelper;
use UnicaenAuth\View\Helper\LdapConnectViewHelperFactory; use UnicaenAuth\View\Helper\LdapConnectViewHelperFactory;
use UnicaenAuth\View\Helper\LocalConnectViewHelper;
use UnicaenAuth\View\Helper\LocalConnectViewHelperFactory; use UnicaenAuth\View\Helper\LocalConnectViewHelperFactory;
use UnicaenAuth\View\Helper\ShibConnectViewHelper;
use UnicaenAuth\View\Helper\ShibConnectViewHelperFactory; use UnicaenAuth\View\Helper\ShibConnectViewHelperFactory;
use UnicaenAuth\View\Helper\UserConnection;
use UnicaenAuth\View\Helper\UserConnectionFactory;
use UnicaenAuth\View\Helper\UserCurrent;
use UnicaenAuth\View\Helper\UserCurrentFactory;
use UnicaenAuth\View\Helper\UserInfo;
use UnicaenAuth\View\Helper\UserInfoFactory;
use UnicaenAuth\View\Helper\UserProfile;
use UnicaenAuth\View\Helper\UserProfileFactory;
use UnicaenAuth\View\Helper\UserProfileSelect;
use UnicaenAuth\View\Helper\UserProfileSelectFactory;
use UnicaenAuth\View\Helper\UserProfileSelectRadioItem;
use UnicaenAuth\View\Helper\UserProfileSelectRadioItemFactory;
use UnicaenAuth\View\Helper\UserStatus;
use UnicaenAuth\View\Helper\UserStatusFactory;
use UnicaenAuth\View\Helper\UserUsurpationHelper;
use UnicaenAuth\View\Helper\UserUsurpationHelperFactory; use UnicaenAuth\View\Helper\UserUsurpationHelperFactory;
use Zend\Authentication\AuthenticationService;
use Zend\ServiceManager\Proxy\LazyServiceFactory;
$settings = [ $settings = [
...@@ -140,22 +170,22 @@ return [ ...@@ -140,22 +170,22 @@ return [
* You may omit the 'action' index to allow access to the entire controller * You may omit the 'action' index to allow access to the entire controller
*/ */
'BjyAuthorize\Guard\Controller' => [ 'BjyAuthorize\Guard\Controller' => [
['controller' => 'index', 'action' => 'index', 'roles' => []], ['controller' => 'index', 'action' => 'index', 'roles' => 'guest'],
['controller' => 'zfcuser', 'roles' => []], ['controller' => 'zfcuser', 'roles' => 'guest'],
['controller' => 'Application\Controller\Index', 'roles' => []], ['controller' => 'Application\Controller\Index', 'roles' => 'guest'],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'etab', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'etab', 'roles' => 'guest'],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'apropos', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'apropos', 'roles' => 'guest'],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'contact', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'contact', 'roles' => 'guest'],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'plan', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'plan', 'roles' => 'guest'],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'mentions-legales', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'mentions-legales', 'roles' => 'guest'],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'informatique-et-libertes', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'informatique-et-libertes', 'roles' => 'guest'],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'refresh-session', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'refresh-session', 'roles' => 'guest'],
['controller' => 'UnicaenAuth\Controller\Utilisateur', 'action' => 'selectionner-profil', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Utilisateur', 'action' => 'selectionner-profil', 'roles' => 'guest'],
['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'shibboleth', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'shibboleth', 'roles' => 'guest'],
['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'requestPasswordReset', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'requestPasswordReset', 'roles' => 'guest'],
['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'changePassword', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'changePassword', 'roles' => 'guest'],
], ],
], ],
], ],
...@@ -411,20 +441,24 @@ return [ ...@@ -411,20 +441,24 @@ return [
], ],
], ],
], ],
//
//( ! ) Warning: Declaration of
// Application\Service\UserContextServiceAwareTrait::setUserContextService(Application\Service\UserContextService $userContextService)
// should be compatible with
// UnicaenAuth\Controller\UtilisateurController::setUserContextService(UnicaenAuth\Service\UserContext $userContextService)
// in /var/www/sygal/module/Application/src/Application/Controller/UtilisateurController.php on line 34
'service_manager' => [ 'service_manager' => [
'aliases' => [ 'aliases' => [
'Zend\Authentication\AuthenticationService' => 'zfcuser_auth_service', 'Zend\Authentication\AuthenticationService' => 'zfcuser_auth_service',
'UnicaenAuth\Privilege\PrivilegeProvider' => 'UnicaenAuth\Service\Privilege', 'UnicaenAuth\Privilege\PrivilegeProvider' => 'UnicaenAuth\Service\Privilege',
'\UnicaenAuth\Guard\PrivilegeController' => 'UnicaenAuth\Guard\PrivilegeController',
'unicaen-auth_user_service' => 'UnicaenAuth\Service\User', // pour la compatibilité 'unicaen-auth_user_service' => 'UnicaenAuth\Service\User', // pour la compatibilité
'authUserContext' => 'UnicaenAuth\Service\UserContext', // pour la compatibilité 'authUserContext' => 'UnicaenAuth\Service\UserContext', // pour la compatibilité
'AuthUserContext' => 'UnicaenAuth\Service\UserContext', // pour la compatibilité
], ],
'invokables' => [ 'invokables' => [
'UnicaenAuth\Authentication\Storage\Db' => 'UnicaenAuth\Authentication\Storage\Db',
'UnicaenAuth\Authentication\Storage\Ldap' => 'UnicaenAuth\Authentication\Storage\Ldap',
'UnicaenAuth\Authentication\Storage\Shib' => 'UnicaenAuth\Authentication\Storage\Shib',
'UnicaenAuth\View\RedirectionStrategy' => 'UnicaenAuth\View\RedirectionStrategy', 'UnicaenAuth\View\RedirectionStrategy' => 'UnicaenAuth\View\RedirectionStrategy',
'UnicaenAuth\Service\User' => 'UnicaenAuth\Service\User',
'UnicaenAuth\Service\CategoriePrivilege' => 'UnicaenAuth\Service\CategoriePrivilegeService', 'UnicaenAuth\Service\CategoriePrivilege' => 'UnicaenAuth\Service\CategoriePrivilegeService',
], ],
'abstract_factories' => [ 'abstract_factories' => [
...@@ -449,6 +483,24 @@ return [ ...@@ -449,6 +483,24 @@ return [
'UnicaenAuth\Service\UserContext' => UserContextFactory::class, 'UnicaenAuth\Service\UserContext' => UserContextFactory::class,
'zfcuser_user_mapper' => UserMapperFactory::class, 'zfcuser_user_mapper' => UserMapperFactory::class,
'MouchardCompleterAuth' => 'UnicaenAuth\Mouchard\MouchardCompleterAuthFactory', 'MouchardCompleterAuth' => 'UnicaenAuth\Mouchard\MouchardCompleterAuthFactory',
'UnicaenAuth\Authentication\Storage\Db' => DbFactory::class,
'UnicaenAuth\Authentication\Storage\Ldap' => LdapFactory::class,
'UnicaenAuth\Authentication\Storage\Shib' => ShibFactory::class,
'UnicaenAuth\Service\User' => UserFactory::class,
'UnicaenAuth\Guard\PrivilegeController' => PrivilegeControllerFactory::class,
'UnicaenAuth\Guard\PrivilegeRoute' => PrivilegeRouteFactory::class,
'UnicaenAuth\Provider\Rule\PrivilegeRuleProvider' => PrivilegeRuleProviderFactory::class,
],
'lazy_services' => [
// Mapping services to their class names is required since the ServiceManager is not a declarative DIC.
'class_map' => [
'zfcuser_auth_service' => AuthenticationService::class,
],
],
'delegators' => [
'zfcuser_auth_service' => [
LazyServiceFactory::class,
],
], ],
'shared' => [ 'shared' => [
'MouchardCompleterAuth' => false, 'MouchardCompleterAuth' => false,
...@@ -460,33 +512,48 @@ return [ ...@@ -460,33 +512,48 @@ return [
'controllers' => [ 'controllers' => [
'invokables' => [ 'invokables' => [
'UnicaenAuth\Controller\Utilisateur' => 'UnicaenAuth\Controller\UtilisateurController',
'UnicaenAuth\Controller\Droits' => 'UnicaenAuth\Controller\DroitsController',
], ],
'factories' => [ 'factories' => [
'UnicaenAuth\Controller\Auth' => AuthControllerFactory::class, 'UnicaenAuth\Controller\Auth' => AuthControllerFactory::class,
'UnicaenAuth\Controller\Utilisateur' => UtilisateurControllerFactory::class,
'UnicaenAuth\Controller\Droits' => DroitsControllerFactory::class,
], ],
], ],
'form_elements' => [ 'form_elements' => [
'invokables' => [ 'invokables' => [
'UnicaenAuth\Form\Droits\Role' => 'UnicaenAuth\Form\Droits\RoleForm', ],
'factories' => [
'UnicaenAuth\Form\Droits\Role' => RoleFormFactory::class,
], ],
], ],
'view_helpers' => [ 'view_helpers' => [
'factories' => [ 'aliases' => [
'userConnection' => 'UnicaenAuth\View\Helper\UserConnectionFactory', 'userConnection' => UserConnection::class,
'userCurrent' => 'UnicaenAuth\View\Helper\UserCurrentFactory', 'userCurrent' => UserCurrent::class,
'userStatus' => 'UnicaenAuth\View\Helper\UserStatusFactory', 'userStatus' => UserStatus::class,
'userProfile' => 'UnicaenAuth\View\Helper\UserProfileFactory', 'userProfile' => UserProfile::class,
'userInfo' => 'UnicaenAuth\View\Helper\UserInfoFactory', 'userInfo' => UserInfo::class,
'userProfileSelect' => 'UnicaenAuth\View\Helper\UserProfileSelectFactory', 'userProfileSelect' => UserProfileSelect::class,
'userProfileSelectRadioItem' => 'UnicaenAuth\View\Helper\UserProfileSelectRadioItemFactory', 'userProfileSelectRadioItem' => UserProfileSelectRadioItem::class,
'userUsurpation' => UserUsurpationHelperFactory::class, 'userUsurpation' => UserUsurpationHelper::class,
'localConnect' => LocalConnectViewHelperFactory::class, 'localConnect' => LocalConnectViewHelper::class,
'ldapConnect' => LdapConnectViewHelperFactory::class, 'ldapConnect' => LdapConnectViewHelper::class,
'shibConnect' => ShibConnectViewHelperFactory::class, 'shibConnect' => ShibConnectViewHelper::class,
],
'factories' => [
UserConnection::class => UserConnectionFactory::class,
UserCurrent::class => UserCurrentFactory::class,
UserStatus::class => UserStatusFactory::class,
UserProfile::class => UserProfileFactory::class,
UserInfo::class => UserInfoFactory::class,
UserProfileSelect::class => UserProfileSelectFactory::class,
UserProfileSelectRadioItem::class => UserProfileSelectRadioItemFactory::class,
UserUsurpationHelper::class => UserUsurpationHelperFactory::class,
LocalConnectViewHelper::class => LocalConnectViewHelperFactory::class,
LdapConnectViewHelper::class => LdapConnectViewHelperFactory::class,
ShibConnectViewHelper::class => ShibConnectViewHelperFactory::class,
], ],
'invokables' => [ 'invokables' => [
'appConnection' => 'UnicaenAuth\View\Helper\AppConnection', 'appConnection' => 'UnicaenAuth\View\Helper\AppConnection',
......
...@@ -69,10 +69,6 @@ CREATE INDEX idx_privilege_id on role_privilege(privilege_id); ...@@ -69,10 +69,6 @@ CREATE INDEX idx_privilege_id on role_privilege(privilege_id);
-- Données -- Données
INSERT INTO user (username, email, display_name, password, state) VALUES
-- utilisateur admin/azerty
('admin', 'admin@mail.fr', 'Administrateur', '$2y$10$QPbyqusyGOOuLlnRCmvZpuKDlAKorxtJJsjeW78bXnIKCFEE.bQiK', 1);
INSERT INTO user_role (id, role_id, is_default, parent_id) VALUES INSERT INTO user_role (id, role_id, is_default, parent_id) VALUES
(1, 'Standard', 1, NULL), (1, 'Standard', 1, NULL),
(2, 'Gestionnaire', 0, 1), (2, 'Gestionnaire', 0, 1),
...@@ -94,6 +90,9 @@ INSERT INTO role_privilege (role_id, privilege_id) VALUES ...@@ -94,6 +90,9 @@ INSERT INTO role_privilege (role_id, privilege_id) VALUES
(4, 3), (4, 3),
(4, 4); (4, 4);
INSERT INTO user (username, email, display_name, password, state) VALUES
-- utilisateur admin/azerty
('admin', 'admin@mail.fr', 'Administrateur', '$2y$10$QPbyqusyGOOuLlnRCmvZpuKDlAKorxtJJsjeW78bXnIKCFEE.bQiK', 1);
INSERT INTO user (username, email, display_name, password, state) VALUES INSERT INTO user (username, email, display_name, password, state) VALUES
-- utilisateur demo/azerty -- utilisateur demo/azerty
('demo', 'demo@mail.fr', 'Demo', '$2y$10$PxXnVLYnGEzEnfqPqRKJSe9AabocES2H4bBK5VzzJlzuj1rVt7Lwu', 1); ('demo', 'demo@mail.fr', 'Demo', '$2y$10$PxXnVLYnGEzEnfqPqRKJSe9AabocES2H4bBK5VzzJlzuj1rVt7Lwu', 1);
......
...@@ -35,7 +35,7 @@ La commande ci-dessus fonctionne seulement si le binaire composer.phar se trouve ...@@ -35,7 +35,7 @@ La commande ci-dessus fonctionne seulement si le binaire composer.phar se trouve
'modules' => array( 'modules' => array(
'Application', 'Application',
'ZfcBase', 'DoctrineModule', 'DoctrineORMModule', 'ZfcUser', 'ZfcUserDoctrineORM', 'BjyAuthorize', 'ZfcBase', 'DoctrineModule', 'DoctrineORMModule', 'ZfcUser', 'BjyAuthorize',
'UnicaenApp', 'AssetManager', 'UnicaenApp', 'AssetManager',
'UnicaenAuth', 'UnicaenAuth',
// ... // ...
......
<?php <?php
translate("Username"); _("Username");
translate("Password"); _("Password");
translate("Email"); _("Email");
translate("Display Name"); _("Display Name");
translate("Password Verify"); _("Password Verify");
translate("Authentication failed. Please try again."); _("Authentication failed. Please try again.");
\ No newline at end of file \ No newline at end of file
...@@ -3,16 +3,15 @@ ...@@ -3,16 +3,15 @@
namespace UnicaenAuth\Assertion; namespace UnicaenAuth\Assertion;
use BjyAuthorize\Service\Authorize; use BjyAuthorize\Service\Authorize;
use UnicaenApp\ServiceManager\ServiceLocatorAwareInterface;
use UnicaenApp\ServiceManager\ServiceLocatorAwareTrait;
use UnicaenAuth\Service\Traits\UserContextServiceAwareTrait; use UnicaenAuth\Service\Traits\UserContextServiceAwareTrait;
use Zend\Mvc\Application;
use Zend\Mvc\Controller\Plugin\FlashMessenger;
use Zend\Mvc\MvcEvent; use Zend\Mvc\MvcEvent;
use Zend\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Zend\Permissions\Acl\Acl; use Zend\Permissions\Acl\Acl;
use Zend\Permissions\Acl\Assertion\AssertionInterface; use Zend\Permissions\Acl\Assertion\AssertionInterface;
use Zend\Permissions\Acl\Resource\ResourceInterface; use Zend\Permissions\Acl\Resource\ResourceInterface;
use Zend\Permissions\Acl\Role\RoleInterface; use Zend\Permissions\Acl\Role\RoleInterface;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorAwareTrait;
/** /**
* Description of AbstractAssertion * Description of AbstractAssertion
...@@ -296,44 +295,63 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw ...@@ -296,44 +295,63 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
return true; return true;
} }
/**
* @var MvcEvent
*/
private $mvcEvent;
/**
* @param MvcEvent $mvcEvent
*/
public function setMvcEvent(MvcEvent $mvcEvent)
{
$this->mvcEvent = $mvcEvent;
}
/** /**
* @return MvcEvent * @return MvcEvent
*/ */
protected function getMvcEvent() protected function getMvcEvent()
{ {
$application = $this->getServiceLocator()->get('Application'); return $this->mvcEvent;
/* @var $application Application */
return $application->getMvcEvent();
} }
/**
* @var Authorize
*/
private $serviceAuthorize;
/**
* @param Authorize $serviceAuthorize
*/
public function setServiceAuthorize(Authorize $serviceAuthorize)
{
$this->serviceAuthorize = $serviceAuthorize;
}
/** /**
* @return Authorize * @return Authorize
*/ */
private function getServiceAuthorize() private function getServiceAuthorize()
{ {
$serviceAuthorize = $this->getServiceLocator()->get('BjyAuthorize\Service\Authorize'); return $this->serviceAuthorize;
/* @var $serviceAuthorize Authorize */
return $serviceAuthorize;
} }
/**
* @param FlashMessenger $fm
* @deprecated Merci d'abandonner cette méthode : SoC violation !
*/
public function setFlashMessenger(FlashMessenger $fm)
{
$this->fm = $fm;
}
/** /**
* @return FlashMessenger * @return FlashMessenger
* @deprecated Merci d'abandonner cette méthode : SoC violation !
*/ */
protected function flashMessenger() protected function flashMessenger()
{ {
if (!$this->fm){
$this->fm = $this->getServiceLocator()->get('controllerpluginmanager')->get('flashmessenger');
}
return $this->fm; return $this->fm;
} }
} }
\ No newline at end of file
...@@ -2,11 +2,16 @@ ...@@ -2,11 +2,16 @@
namespace UnicaenAuth\Authentication\Adapter; namespace UnicaenAuth\Authentication\Adapter;
use Interop\Container\ContainerInterface;
use UnicaenApp\Exception\LogicException; use UnicaenApp\Exception\LogicException;
use UnicaenAuth\Options\ModuleOptions;
use UnicaenAuth\Service\User;
use Zend\EventManager\EventManager; use Zend\EventManager\EventManager;
use Zend\EventManager\EventManagerAwareInterface; use Zend\EventManager\EventManagerAwareInterface;
use Zend\Router\Http\TreeRouteStack;
use Zend\ServiceManager\AbstractFactoryInterface; use Zend\ServiceManager\AbstractFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface; use Zend\ServiceManager\ServiceLocatorInterface;
use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper;
/** /**
* Description of AbstractFactory * Description of AbstractFactory
...@@ -15,28 +20,22 @@ use Zend\ServiceManager\ServiceLocatorInterface; ...@@ -15,28 +20,22 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/ */
class AbstractFactory implements AbstractFactoryInterface class AbstractFactory implements AbstractFactoryInterface
{ {
/**
* Determine if we can create a service with name
*
* @param ServiceLocatorInterface $serviceLocator
* @param $name
* @param $requestedName
* @return bool
*/
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
{ {
return strpos($requestedName, __NAMESPACE__) === 0 && class_exists($requestedName); return $this->canCreate($serviceLocator, $requestedName);
} }