Newer
Older
<?php
/**
* Copyright (C) 2019 Leipzig University Library
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @author Sebastian Kehr <kehr@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
use fid\Controller\UserController;
use fid\Controller\UserControllerFactory;
use fid\FormModel\UsernameChangeModel;
use fid\FormModel\PasswordChangeModel;
use fid\FormModel\PasswordResetModel;
use fid\FormModel\UserCreateModel;
use fid\FormModel\UserInitModel;
use fid\FormModel\UserUpdateModel;
use fid\Helper\RegistrationFormLabel;
use fid\Helper\TranslatorDelegator;
use fid\Listener\ErrorListener;
use fid\Listener\ErrorListenerFactory;
use fid\Listener\LocaleListener;
use fid\Service\Client;
use fid\Service\ClientFactory;
use fid\VuFind\Auth\Authenticator;
use fid\VuFind\Auth\AuthenticatorFactory;
use fid\VuFind\Auth\ILSAuthenticator;
use fid\VuFind\Auth\ILSAuthenticatorFactory;
use fid\VuFind\Db\Row\User;
use fid\VuFind\Db\Row\UserDelegatorFactory;
use fid\VuFind\ILS\Fid;
use fid\VuFind\ILS\FidFactory;
use VuFind\Auth\ILSAuthenticator as BaseILSAuthenticator;
use VuFind\Db\Row\User as BaseUser;
use VuFind\Db\Row\UserFactory;
use Zend\Mvc\I18n\Translator;
use Zend\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Zend\ServiceManager\Factory\InvokableFactory;
return [
'forms' => [
UserInitModel::class => require_once 'user-init-form.php',
UserCreateModel::class => require_once 'user-create-form.php',
UserUpdateModel::class => require_once 'user-update-form.php',
PasswordResetModel::class => require_once 'password-reset-form.php',
PasswordChangeModel::class => require_once 'password-change-form.php',
UsernameChangeModel::class => require_once 'username-change-form.php',
],
'controllers' => [
'factories' => [
UserController::class => UserControllerFactory::class,
]
],
'listeners' => [
ErrorListener::class,
LocaleListener::class,
],
'view_helpers' => [
'formLabel' => RegistrationFormLabel::class,
],
],
// TODO: add alias to vufind core
'controller_plugins' => [
'aliases' => [
'flashmessenger' => FlashMessenger::class,
]
],
'service_manager' => [
'aliases' => [
BaseILSAuthenticator::class => ILSAuthenticator::class,
'MvcTranslator' => Translator::class,
],
'delegators' => [
ILSAuthenticator::class => [
ILSAuthenticatorFactory::class,
],
Translator::class => [
TranslatorDelegator::class,
],
],
'factories' => [
Client::class => ClientFactory::class,
ErrorListener::class => ErrorListenerFactory:: class,
ILSAuthenticator::class => ILSAuthenticatorFactory::class,
LocaleListener::class => InvokableFactory::class,
],
],
'vufind' => [
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
'plugin_managers' => [
'auth' => [
'aliases' => [
'fid' => Authenticator::class,
],
'factories' => [
Authenticator::class => AuthenticatorFactory::class,
],
],
'db_row' => [
'aliases' => [
BaseUser::class => User::class,
],
'delegators' => [
User::class => [
UserDelegatorFactory::class,
],
],
'factories' => [
User::class => UserFactory::class,
],
],
'ils_driver' => [
'aliases' => [
'fid' => Fid::class,
],
'factories' => [
Fid::class => FidFactory::class,
],
],
],
],
// Authorization configuration:
'zfc_rbac' => [
'vufind_permission_provider_manager' => [
'factories' => [
'fid\Role\PermissionProvider\FidApiPermission' =>
'fid\Role\PermissionProvider\Factory::getFidApiPermission'
],
'aliases' => [
'FidApiPermission' => 'fid\Role\PermissionProvider\FidApiPermission'
]
]
],
'router' => [
'routes' => [
'fid' => [
'type' => 'literal',
'may_terminate' => false,
'options' => [
'route' => '/fid',
],
'child_routes' => [
'user' => [
'may_terminate' => false,
'type' => 'literal',
'options' => [
'route' => '/user',
],
'child_routes' => [
'init' => [
'may_terminate' => true,
'type' => 'literal',
'options' => [
'route' => '/init',
'defaults' => [
'controller' => UserController::class,
'action' => 'init',
],
],
],
'create' => [
'type' => 'literal',
'options' => [
'route' => '/create',
'defaults' => [
'controller' => UserController::class,
'action' => 'create',
],
],
],
'update' => [
'type' => 'literal',
'options' => [
'route' => '/update',
'defaults' => [
'controller' => UserController::class,
'action' => 'update',
],
],
],
'policy' => [
'type' => 'literal',
'options' => [
'route' => '/policy',
'defaults' => [
'controller' => UserController::class,
'action' => 'policy',
],
],
],
'terms' => [
'type' => 'literal',
'options' => [
'route' => '/terms',
'defaults' => [
'controller' => UserController::class,
'action' => 'terms',
],
],
],
'reset-password' => [
'type' => 'literal',
'options' => [
'route' => '/reset-password',
'defaults' => [
'controller' => UserController::class,
'action' => 'resetPassword',
],
],
],
'change-password' => [
'type' => 'literal',
'options' => [
'route' => '/change-password',
'defaults' => [
'controller' => UserController::class,
'action' => 'changePassword',
],
],
],
'change-username' => [
'type' => 'literal',
'options' => [
'route' => '/change-username',
'defaults' => [
'controller' => UserController::class,
'action' => 'changeUsername',
],
],
],
'update-username' => [
'type' => 'literal',
'options' => [
'route' => '/update-username',
'defaults' => [
'controller' => UserController::class,
'action' => 'updateUsername',
],
],
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
'admin' => [
'may_terminate' => false,
'type' => 'literal',
'options' => [
'route' => '/admin'
],
'child_routes' => [
'list' => [
'type' => 'literal',
'options' => [
'route' => '/list',
'defaults' => [
'controller' => UserController::class,
'action' => 'list',
],
],
],
'edit' => [
'type' => 'Zend\Router\Http\Segment',
'options' => [
'route' => '/edit/[:userid]',
'defaults' => [
'controller' => UserController::class,
'action' => 'edit',
'userid' => null
],
],
],
],
],
],
],
'myresearch-account' => [
'options' => [
'defaults' => [
'controller' => UserController::class,
'action' => 'init',
],
],
],
'myresearch-recover' => [
'options' => [
'defaults' => [
'controller' => UserController::class,
'action' => 'resetPassword',
]
]
]