Premier commit
This commit is contained in:
73
modules/user/Module.php
Normal file
73
modules/user/Module.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the Piko user module
|
||||
*
|
||||
* @copyright 2020 Sylvain PHILIP.
|
||||
* @license LGPL-3.0; see LICENSE.txt
|
||||
* @link https://github.com/piko-framework/piko-user
|
||||
*
|
||||
* Routes :
|
||||
* /user/default/login : Process login
|
||||
* /user/default/logout : Process logout
|
||||
* /user/default/register : Process user registration
|
||||
* /user/default/edit : User account form
|
||||
* /user/admin/users : Manage users, roles, permissions
|
||||
*/
|
||||
namespace app\modules\user;
|
||||
|
||||
use PDO;
|
||||
use app\modules\user\models\User;
|
||||
use app\modules\user\Rbac;
|
||||
|
||||
|
||||
/**
|
||||
* User module class
|
||||
*
|
||||
* @author Sylvain PHILIP <contact@sphilip.com>
|
||||
*/
|
||||
class Module extends \Piko\Module
|
||||
{
|
||||
/**
|
||||
* The admin role
|
||||
* @var string
|
||||
*/
|
||||
public $adminRole = 'admin';
|
||||
|
||||
/**
|
||||
* Allow user registration
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $allowUserRegistration = false;
|
||||
|
||||
/**
|
||||
* Min length of the user password
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $passwordMinLength = 8;
|
||||
|
||||
public function bootstrap()
|
||||
{
|
||||
$pdo = $this->application->getComponent('PDO');
|
||||
assert($pdo instanceof PDO);
|
||||
|
||||
User::$pdo = $pdo;
|
||||
Rbac::$db = $pdo;
|
||||
AccessChecker::$adminRole = $this->adminRole;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \piko\Module::init()
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
/* @var $i18n \piko\i18n */
|
||||
// $i18n = Piko::get('i18n');
|
||||
// $i18n->addTranslation('user', __DIR__ . '/messages');
|
||||
|
||||
// parent::init();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user