|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace LmcUser; |
|
6
|
|
|
|
|
7
|
|
|
use Laminas\Hydrator\ClassMethodsHydrator; |
|
8
|
|
|
use Laminas\ModuleManager\Feature\ConfigProviderInterface; |
|
9
|
|
|
use Laminas\ModuleManager\Feature\ControllerPluginProviderInterface; |
|
10
|
|
|
use Laminas\ModuleManager\Feature\ControllerProviderInterface; |
|
11
|
|
|
use Laminas\ModuleManager\Feature\ServiceProviderInterface; |
|
12
|
|
|
use Laminas\ModuleManager\Feature\ViewHelperProviderInterface; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class Module |
|
16
|
|
|
*/ |
|
17
|
|
|
class Module implements |
|
18
|
|
|
ConfigProviderInterface, |
|
19
|
|
|
ControllerPluginProviderInterface, |
|
20
|
|
|
ControllerProviderInterface, |
|
21
|
|
|
ServiceProviderInterface, |
|
22
|
|
|
ViewHelperProviderInterface |
|
23
|
|
|
{ |
|
24
|
|
|
public const LMC_USER_SESSION_STORAGE_NAMESPACE = 'LmcUserNamespace'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* {@inheritDoc} |
|
28
|
|
|
* @see \Laminas\ModuleManager\Feature\ConfigProviderInterface::getConfig() |
|
29
|
|
|
*/ |
|
30
|
|
|
public function getConfig() |
|
31
|
|
|
{ |
|
32
|
|
|
return include __DIR__ . '/config/module.config.php'; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* {@inheritDoc} |
|
37
|
|
|
* @see \Laminas\ModuleManager\Feature\ControllerPluginProviderInterface::getControllerPluginConfig() |
|
38
|
|
|
*/ |
|
39
|
|
|
public function getControllerPluginConfig() |
|
40
|
|
|
{ |
|
41
|
|
|
return [ |
|
42
|
|
|
'factories' => [ |
|
43
|
|
|
'lmcUserAuthentication' => Factory\Controller\Plugin\LmcUserAuthentication::class, |
|
44
|
|
|
], |
|
45
|
|
|
]; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* {@inheritDoc} |
|
50
|
|
|
* @see \Laminas\ModuleManager\Feature\ControllerProviderInterface::getControllerConfig() |
|
51
|
|
|
*/ |
|
52
|
|
|
public function getControllerConfig() |
|
53
|
|
|
{ |
|
54
|
|
|
return [ |
|
55
|
|
|
'factories' => [ |
|
56
|
|
|
'lmcuser' => Factory\Controller\UserControllerFactory::class, |
|
57
|
|
|
], |
|
58
|
|
|
]; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* {@inheritDoc} |
|
63
|
|
|
* @see \Laminas\ModuleManager\Feature\ViewHelperProviderInterface::getViewHelperConfig() |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getViewHelperConfig() |
|
66
|
|
|
{ |
|
67
|
|
|
return [ |
|
68
|
|
|
'factories' => [ |
|
69
|
|
|
'lmcUserDisplayName' => Factory\View\Helper\LmcUserDisplayName::class, |
|
70
|
|
|
'lmcUserIdentity' => Factory\View\Helper\LmcUserIdentity::class, |
|
71
|
|
|
'lmcUserLoginWidget' => Factory\View\Helper\LmcUserLoginWidget::class, |
|
72
|
|
|
], |
|
73
|
|
|
]; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* {@inheritDoc} |
|
78
|
|
|
* @see \Laminas\ModuleManager\Feature\ServiceProviderInterface::getServiceConfig() |
|
79
|
|
|
*/ |
|
80
|
|
|
public function getServiceConfig() |
|
81
|
|
|
{ |
|
82
|
|
|
return [ |
|
83
|
|
|
'aliases' => [ |
|
84
|
|
|
'lmcuser_laminas_db_adapter' => \Laminas\Db\Adapter\Adapter::class, |
|
85
|
|
|
'lmcuser_register_form_hydrator' => 'lmcuser_user_hydrator', |
|
86
|
|
|
'lmcuser_base_hydrator' => 'lmcuser_default_hydrator', |
|
87
|
|
|
], |
|
88
|
|
|
'invokables' => [ |
|
89
|
|
|
'lmcuser_default_hydrator' => ClassMethodsHydrator::class, |
|
90
|
|
|
], |
|
91
|
|
|
'factories' => [ |
|
92
|
|
|
'lmcuser_redirect_callback' => Factory\Controller\RedirectCallbackFactory::class, |
|
93
|
|
|
'lmcuser_module_options' => Factory\Options\ModuleOptions::class, |
|
94
|
|
|
Authentication\Adapter\AdapterChain::class => Authentication\Adapter\AdapterChainServiceFactory::class, |
|
95
|
|
|
|
|
96
|
|
|
// We alias this one because it's LmcUser's instance of |
|
97
|
|
|
// Laminas\Authentication\AuthenticationService. We don't want to |
|
98
|
|
|
// hog the FQCN service alias for a Laminas\* class. |
|
99
|
|
|
'lmcuser_auth_service' => Factory\AuthenticationService::class, |
|
100
|
|
|
|
|
101
|
|
|
'lmcuser_user_hydrator' => Factory\UserHydrator::class, |
|
102
|
|
|
'lmcuser_user_mapper' => Factory\Mapper\User::class, |
|
103
|
|
|
|
|
104
|
|
|
'lmcuser_login_form' => Factory\Form\Login::class, |
|
105
|
|
|
'lmcuser_register_form' => Factory\Form\Register::class, |
|
106
|
|
|
'lmcuser_change_password_form' => Factory\Form\ChangePassword::class, |
|
107
|
|
|
'lmcuser_change_email_form' => Factory\Form\ChangeEmail::class, |
|
108
|
|
|
|
|
109
|
|
|
Authentication\Adapter\Db::class => Factory\Authentication\Adapter\DbFactory::class, |
|
110
|
|
|
Authentication\Storage\Db::class => Factory\Authentication\Storage\DbFactory::class, |
|
111
|
|
|
|
|
112
|
|
|
'lmcuser_user_service' => Factory\Service\UserFactory::class, |
|
113
|
|
|
], |
|
114
|
|
|
]; |
|
115
|
|
|
} |
|
116
|
|
|
} |
|
117
|
|
|
|