Skip to content

Commit

Permalink
php 8
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Jun 8, 2022
1 parent 8b77d85 commit 556f836
Show file tree
Hide file tree
Showing 68 changed files with 391 additions and 380 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PlaygroundUser

#Introduction

Ce module étend ZfcUser qui permet de nombreuses fonctionnalités liées à la gestion d'un compte client.
Ce module étend LmcUser qui permet de nombreuses fonctionnalités liées à la gestion d'un compte client.

Le fonctionnalités apportées par PgUser sont :
* Gestion des autorisations via BjyAuthorize
Expand All @@ -31,23 +31,23 @@ La commande php doctrine-module.php data-fixture:import --append permet d'instal
## Use your own User entity
If you want to use your own entity :

1. Change the value of 'user_entity_class' in the zfcuser.global.php file.
1. Change the value of 'user_entity_class' in the lmcuser.global.php file.

'user_entity_class' => 'MyUser\Entity\User',

2. Put your doctrine definition in your module.config.php Module (the one extending the user entity)

'doctrine' => array(
'driver' => array(
'zfcuser_entity' => array(
'lmcuser_entity' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => __DIR__ . '/../src/MyUser/Entity'
),

'orm_default' => array(
'drivers' => array(
'MyUser\Entity' => 'zfcuser_entity'
'MyUser\Entity' => 'lmcuser_entity'
)
)
)
Expand All @@ -65,7 +65,7 @@ And in your Module.php onBootstrap method, You have then to use the doctrine lis
$sm = $e->getApplication()->getServiceManager();
$doctrine = $sm->get('application_doctrine_em');
$evm = $doctrine->getEventManager();

$listener = new \Doctrine\ORM\Tools\ResolveTargetEntityListener();
$listener->addResolveTargetEntity(
'PgUser\Entity\UserInterface',
Expand All @@ -88,7 +88,7 @@ If you want to change the ChangeInfo Form for example (ie. you want to add a 'ch

parent::__construct($name, $createOptions, $translator);

And then you add the Form elements you want
And then you add the Form elements you want

$this->add(array(
'type' => 'Laminas\Form\Element\Select',
Expand Down Expand Up @@ -145,16 +145,16 @@ If you want to add an action or modify an existing one.
'children_views' => array(
'col_left' => 'adfab-user/layout/col-user.phtml',
),
),
),
),
),
'controllers' => array(
'invokables' => array(
'myuser_user' => 'MyUser\Controller\UserController',
),
),
),
'router' => array(
'routes' => array(
'zfcuser' => array(
'lmcuser' => array(
'child_routes' => array(
'profile' => array(
'type' => 'Laminas\Router\Http\Literal',
Expand Down
17 changes: 14 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@
"homepage": "http://www.playground.gg"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/gregorybesson/zfc-datagrid"
}
],
"require": {
"php": ">=7.3.0",
"facebook/graph-sdk": "^5.6",
"playground/design": "^5.0",
"playground/design": "^6.0",
"laminas/laminas-developer-tools": ">=1.0.0",
"hybridauth/hybridauth": "@RC",
"zf-commons/zfc-user": ">=3.0.0",
"laminas/laminas-dependency-plugin": "^2.1"
"laminas/laminas-dependency-plugin": "^2.1",
"lm-commons/lmc-user": "^3.5"
},
"require-dev": {
"phpunit/phpunit": ">=4.0.0",
Expand All @@ -39,5 +45,10 @@
"branch-alias": {
"dev-master": "5.x-dev"
}
},
"config": {
"allow-plugins": {
"laminas/laminas-dependency-plugin": true
}
}
}
12 changes: 6 additions & 6 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

'doctrine' => array(
'driver' => array(
'zfcuser_entity' => array(
'lmcuser_entity' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => __DIR__ . '/../src/Entity'
),

'orm_default' => array(
'drivers' => array(
'PlaygroundUser\Entity' => 'zfcuser_entity'
'PlaygroundUser\Entity' => 'lmcuser_entity'
)
)
),
Expand Down Expand Up @@ -53,7 +53,7 @@

'guards' => array(
'BjyAuthorize\Guard\Controller' => array(
array('controller' => 'zfcuser', 'roles' => array('guest', 'user')),
array('controller' => 'lmcuser', 'roles' => array('guest', 'user')),
array('controller' => \PlaygroundUser\Controller\Frontend\UserController::class, 'roles' => array('guest', 'user')),
array('controller' => \PlaygroundUser\Controller\Frontend\TeamController::class, 'roles' => array('guest', 'user')),
array('controller' => \PlaygroundUser\Controller\Frontend\ForgotController::class, 'roles' => array('guest', 'user')),
Expand Down Expand Up @@ -195,13 +195,13 @@
)
),
),
'zfcuser' => array(
'lmcuser' => array(
'type' => 'Laminas\Router\Http\Literal',
'priority' => 1000,
'options' => array(
'route' => 'mon-compte',
'defaults' => array(
'controller' => 'zfcuser',
'controller' => 'lmcuser',
'action' => 'index',
),
),
Expand Down Expand Up @@ -638,7 +638,7 @@

'newsletter' => array(
'label' => 'Newsletter',
'route' => 'frontend/zfcuser/newsletter',
'route' => 'frontend/lmcuser/newsletter',
'controller' => \PlaygroundUser\Controller\Frontend\UserController::class,
'action' => 'newsletter',
),
Expand Down
44 changes: 22 additions & 22 deletions config/playgrounduser.global.php.dist
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<?php
$playgrounduser = array(

/**
* add default registration role to BjyAuthorize
*
*/
'default_register_role' => 'user',

/**
* @var bool
* true = create user automatically after social authentication
* false = data are extracted from the social id and sent to a registration form
*/
'createUserAutoSocial' => false,

/**
* Email Address that will appear in the 'From' of outbound emails
*
* Default: empty
*/
*/
'email_from_address' => array(
'email' => '[email protected]',
'name' => 'Administrateur',
),

/**
* Subject line of the email message which is
* sent out when a user enters their email address
*
* Default: 'You requested to reset your password'
*/
'reset_email_subject_line' => 'Réinitialisation de votre mot de passe',

/**
* Subject line of the email message which is
* sent out when an admin has changed the password
Expand All @@ -40,7 +40,7 @@ $playgrounduser = array(
* Default: 'Your new password'
*/
'new_email_subject_line' => 'Votre nouveau mot de passe',

/**
* Activate the email verification on registration
*
Expand All @@ -55,24 +55,24 @@ $playgrounduser = array(
* Default subject : 'Merci de votre inscription'
*/
'emailConfirmation' => true,

/**
* Subject line of the email message which is
* sent out when verification on email registration
* is activated
*
*
* Default: 'Vérification de votre compte'
*/
'verificationEmailSubjectLine' => 'Vérification de votre compte',

/**
* RememberMe Model Entity Class
*
* Name of Entity class to use. Useful for using your own entity class
* instead of the default one provided. Default is ZfcUser\Entity\User.
* instead of the default one provided. Default is LmcUser\Entity\User.
*/
'remember_me_entity_class' => 'PlaygroundUser\Entity\RememberMe',

/**
* Remember me cookie expire time
*
Expand All @@ -82,17 +82,17 @@ $playgrounduser = array(
* Accepted values: the number of seconds the user should be remembered
*/
'cookie_expire' => 2592000,

/**
* Drive path to the directory where user avatar will be stored
*/
'avatar_path' => 'public' . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'user',

/**
* Url relative path to the directory where user avatar will be stored
*/
'avatar_url' => 'media/user',

'social' => array(
'providers' => include __DIR__.'/social.config.php',
// if you want to enable logging, set 'debug_mode' to true then provide a writable file by the web server on 'debug_file'
Expand Down Expand Up @@ -127,28 +127,28 @@ $playgrounduser = array(
);

/**
* ZfcUser Configuration
* LmcUser Configuration
*
* If you have a ./config/autoload/ directory set up for your project, you can
* drop this config file in it and change the values as you wish.
*/
$zfcSettings = array(
$LmcSettings = array(

/**
* Authentication Adapters
*
* Specify the adapters that will be used to try and authenticate the user
*
* Default value: array containing 'ZfcUser\Authentication\Adapter\Db'
* Accepted values: array containing services that implement 'ZfcUser\Authentication\Adapter\ChainableAdapter'
* Default value: array containing 'LmcUser\Authentication\Adapter\Db'
* Accepted values: array containing services that implement 'LmcUser\Authentication\Adapter\ChainableAdapter'
*/
'auth_adapters' => array(
50 => 'PlaygroundUser\Authentication\Adapter\Cookie',
100 => 'ZfcUser\Authentication\Adapter\Db'
100 => 'LmcUser\Authentication\Adapter\Db'
),

/**
* End of ZfcUser configuration
* End of LmcUser configuration
*/
);

Expand All @@ -157,5 +157,5 @@ $zfcSettings = array(
*/
return array(
'playgrounduser' => $playgrounduser,
'zfcuser' => $zfcSettings,
'lmcuser' => $LmcSettings,
);
10 changes: 5 additions & 5 deletions src/Authentication/Adapter/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace PlaygroundUser\Authentication\Adapter;

use ZfcUser\Authentication\Adapter\AbstractAdapter;
use LmcUser\Authentication\Adapter\AbstractAdapter;
use Laminas\Authentication\Result as AuthenticationResult;
use Laminas\ServiceManager\ServiceManager;
use Laminas\Stdlib\ResponseInterface as Response;
Expand Down Expand Up @@ -37,7 +37,7 @@ public function authenticate(\Laminas\EventManager\EventInterface $e)
* but afterwords login with identity/credential
* we remove the "cookieLogin" session.
*/
$session = new \Laminas\Session\Container('zfcuser');
$session = new \Laminas\Session\Container('lmcuser');
$session->offsetSet("cookieLogin", false);

return;
Expand Down Expand Up @@ -96,7 +96,7 @@ public function authenticate(\Laminas\EventManager\EventInterface $e)
->setMessages(array('Authentication successful.'));

// Reference for weak login. Should not be allowed to change PW etc.
$session = new \Laminas\Session\Container('zfcuser');
$session = new \Laminas\Session\Container('lmcuser');
$session->offsetSet("cookieLogin", true);
}

Expand Down Expand Up @@ -143,7 +143,7 @@ public function setUserMapper($userMapper)
public function getUserMapper()
{
if (null === $this->userMapper) {
$this->userMapper = $this->getServiceManager()->get('zfcuser_user_mapper');
$this->userMapper = $this->getServiceManager()->get('lmcuser_user_mapper');
}

return $this->userMapper;
Expand All @@ -170,7 +170,7 @@ public function getRememberMeService()
*/
public function logout()
{
$authService = $this->getServiceManager()->get('zfcuser_auth_service');
$authService = $this->getServiceManager()->get('lmcuser_auth_service');
$user = $authService->getIdentity();

$cookie = explode("\n", $this->getRememberMeService()->getCookie());
Expand Down
4 changes: 2 additions & 2 deletions src/Authentication/Adapter/EmailValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace PlaygroundUser\Authentication\Adapter;

use ZfcUser\Authentication\Adapter\AbstractAdapter;
use LmcUser\Authentication\Adapter\AbstractAdapter;
use Laminas\Authentication\Result as AuthenticationResult;
use Laminas\EventManager\EventInterface as AuthEvent;
use Laminas\ServiceManager\ServiceManager;
Expand Down Expand Up @@ -92,7 +92,7 @@ public function setServiceManager(ServiceManager $serviceManager)
public function getUserService()
{
if (!$this->userService) {
$this->userService = $this->getServiceManager()->get('zfcuser_user_service');
$this->userService = $this->getServiceManager()->get('lmcuser_user_service');
}

return $this->userService;
Expand Down
Loading

0 comments on commit 556f836

Please sign in to comment.