Yii2 User Extended to extend Yii2 User by Dektrium: https://github.com/dektrium/yii2-user
This is not an standalone module to manage users but a module to extend Yii2 User extension.
The preferred way to install this extension is through composer.
Either run
php composer.phar require cinghie/yii2-user-extended "*"
or add this line to the require section of your composer.json
file.
"cinghie/yii2-user-extended": "*"
Copy img folder to your webroot
Make sure that you have properly configured db
application component
and run the following command:
$ php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrations
Add to common config file
'components' => [
'authManager' => [
'class' => 'yii\rbac\DbManager',
],
]
'modules' => [
'rbac' => 'dektrium\rbac\RbacWebModule',
],
and run migration
$ php yii migrate/up --migrationPath=@yii/rbac/migrations
$ php yii migrate/up --migrationPath=@vendor/cinghie/yii2-user-extended/migrations
Set on your configuration file, in modules section
'modules' => [
// Yii2 RBAC
'rbac' => [
'class' => 'dektrium\rbac\Module'
],
// Yii2 User
'user' => [
'class' => 'dektrium\user\Module',
// Yii2 User Controllers Overrides
'controllerMap' => [
'admin' => 'cinghie\userextended\controllers\AdminController',
'security' => 'cinghie\userextended\controllers\SecurityController',
'settings' => 'cinghie\userextended\controllers\SettingsController'
],
// Yii2 User Models Overrides
'modelMap' => [
'RegistrationForm' => 'cinghie\userextended\models\RegistrationForm',
'Profile' => 'cinghie\userextended\models\Profile',
'SettingsForm' => 'cinghie\userextended\models\SettingsForm',
'User' => 'cinghie\userextended\models\User',
],
],
// Yii2 User Extended
'userextended' => [
'class' => 'cinghie\userextended\Module',
'avatarPath' => '@webroot/img/users/', // Path to your avatar files
'avatarURL' => '@web/img/users/', // Url to your avatar files
'defaultRole' => '', // example 'registered'
'avatar' => true,
'bio' => false,
'captcha' => true,
'birthday' => true,
'firstname' => true,
'gravatarEmail' => false,
'lastname' => true,
'location' => false,
'onlyEmail' => false,
'publicEmail' => false,
'signature' => true,
'templateLogin' => 'login_prestashop', // login or login_prestashop
'templateLogoURL' => '@web/logo.png', // Url to logo
'templateRegister' => '_two_column', // _one_column or _two_column
'terms' => true,
'website' => false,
'showTitles' => true, // Set false in adminLTE
],
]
and in components section
'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@dektrium/rbac/views/permission' => '@vendor/cinghie/yii2-user-extended/views/permission',
'@dektrium/rbac/views/role' => '@vendor/cinghie/yii2-user-extended/views/role',
'@dektrium/rbac/views/rule' => '@vendor/cinghie/yii2-user-extended/views/rule',
'@dektrium/user/views/admin' => '@vendor/cinghie/yii2-user-extended/views/admin',
'@dektrium/user/views/profile' => '@vendor/cinghie/yii2-user-extended/views/profile',
'@dektrium/user/views/role' => '@vendor/cinghie/yii2-user-extended/views/role',
'@dektrium/user/views/security' => '@vendor/cinghie/yii2-user-extended/views/adminlte/security',
'@dektrium/user/views/settings' => '@vendor/cinghie/yii2-user-extended/views/settings',
],
],
],
]
If you have a Yii2 App Advanced add in Yii2 User Module config
'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
// restrict access to recovery and registration controllers from backend
'as backend' => 'dektrium\user\filters\BackendFilter',
// Settings
'enableRegistration' => false,
],
],
Or use userextended filter that active profile and settings on backend (dektrium filter disable it)
'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
// restrict access to recovery and registration controllers from backend
'as backend' => 'cinghie\userextended\filters\BackendFilter',
// Settings
'enableRegistration' => false,
],
],
in your SiteController set in actions() function
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'minLength' => 6,
'maxLength' => 6
],
Override controller example, on modules config
'modules' => [
'userextended' => [
'class' => 'cinghie\userextended\Module',
'controllerMap' => [
'items' => 'app\controllers\AdminController',
'items' => 'app\controllers\SecurityController',
'items' => 'app\controllers\SettingsController',
]
]
],
Override models example, on modules config
'modules' => [
'userextended' => [
'class' => 'cinghie\userextended\Module',
'modelMap' => [
'Account' => 'app\models\Account',
'Assignment' => 'app\models\Assignment',
'LoginForm' => 'app\models\LoginForm',
'Permission' => 'app\models\Permission',
'Profile' => 'app\models\Profile',
'RegistrationForm' => 'app\models\RegistrationForm',
'SettingsForm' => 'app\models\SettingsForm',
'User' => 'app\models\User',
]
]
],
Override view example, on components config
'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@cinghie/userextended/views/admin' => '@app/views/userextended/admin',
],
],
],
],
Comments