yii2-extension cfusermgmt
Yii2 Advance User Management Plugin
codefiretech/cfusermgmt
Yii2 Advance User Management Plugin
- Monday, May 4, 2015
- by pranjalcodefire
- Repository
- 1 Watchers
- 1 Stars
- 70 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 1 Versions
- 1 % Grown
Steps To install the 'cfusermgmt' plugin:
- You can use composer to install extension add below line in your composer require
"codefiretech/cfusermgmt": "dev-master" or Just copy the folder into vendor/yiisoft directory of your ADVANCED application.(While extracting remember that all the hidden files or like .htaccess files are also copied)
Note - If you are using composer then place the vendor/codefiretech/cfusermgmt folder inside vendor/yiisoft folder.
- Open your extension.php (in yiisoft folder of your application) and add the array in the list of extensions as-
'yiisoft/cfusermgmt' =>
array (
'name' => 'yiisoft/cfusermgmt',
'version' => '2.0.2.0',
'alias' =>
array (
'@yii/cfusermgmt' => $vendorDir . '/yiisoft/cfusermgmt',
),
),
-
in common/config/main.php (in components) add below array and change BaseFolderName to your base folder name
'authManager'=>[
'class'=>'yii\rbac\DbManager',
'defaultRoles' => [DEFAULT_ROLE_NAME]
],
'user' => [
'identityClass' => 'yii\cfusermgmt\common\models\User',
'enableAutoLogin' => true,
],
'urlManager'=>[
'showScriptName'=>false,
'enablePrettyUrl'=>true,
'enableStrictParsing'=>false,
'rules'=>[
[
'pattern'=>'controller:\w+/action:\w+',
'route'=>'/',
]
],
],
'urlManagerBackend' => [
'class' => 'yii\web\urlManager',
'baseUrl' => '/BaseFolderName/advanced/vendor/yiisoft/cfusermgmt/backend/web',
'enablePrettyUrl' => true,
'showScriptName' => false,
],
'urlManagerFrontend' => [
'class' => 'yii\web\urlManager',
'baseUrl' => '/BaseFolderName/advanced/vendor/yiisoft/cfusermgmt/frontend/web',
'enablePrettyUrl' => true,
'showScriptName' => false,
],, (*1)
add parameter array (sibling to components)
'params'=>[
'home_base_path' => DIR . '/../../',
], (*2)
- Table name for users and user have a single array of user identity
- delete User.php from common/models
- remove user array from backend/config main.php (from components)
- remove user array from frontend/config main.php (from components)
- Now user model is placed in new path (vendor\yiisoft\cfusermgmt\common\models) so place your user model function(if any) there.
-
add below line in index.php before $application->run() for both frontend and backend.
include_once DIR . '/../../vendor/yiisoft/cfusermgmt/common/config/constants.php';, (*3)
-
Include below lines in the (frontend & backend)/web/.htaccess file: (This is to ignore the "index.php" in the url), (*4)
Options -MultiViews
RewriteEngine On
#RewriteBase /path/to/app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
, (*5)
Order allow,deny
allow from all, (*6)
NOTES:
- make sure you have import database from plugin.sql file
- Admin credentials (codefire/111111)
Useful Url example:
- FrontEnd Url (http://localhost/BaseFolderName/advanced/vendor/yiisoft/cfusermgmt/frontend/web/user/login)
- BackEnd Url (http://localhost/BaseFolderName/advanced/vendor/yiisoft/cfusermgmt/backend/web/user/login)