Yii 2.0 user management extension
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist anli/yii2-user "*"
or add
"anli/yii2-user": "*"
to the require section of your composer.json
file.
Update config/auth0-local.php
with:
<?php
if (YII_ENV_DEV) {
return [
'serviceId' => 'my-service',
'domain' => 'my-account.auth0.com',
'clientId' => '',
'clientSecret' => '',
'redirectUrl' => '',
'apiTokens' => [
'usersRead' => '',
'usersUpdate' => '',
]
];
}
return [
'serviceId' => '',
'domain' => '',
'clientId' => '',
'clientSecret' => '',
'redirectUrl' => '',
'apiTokens' => [
'usersRead' => '',
'usersUpdate' => '',
]
];
Update .gitignore
with:
/config/auth0-local.php
Update config/web.php
components section with:
'components' =>
...
'auth0' => array_merge([
'class' => 'anli\user\components\Auth0',
'adminEmails' => ['admin@email.com'],
], require(__DIR__ . '/auth0-local.php')),
'tenant' => [
'class' => 'anli\user\components\Tenant',
],
and
'components' =>
...
'user' => [
...
'identityClass' => 'anli\user\models\User',
...
],
Update config/web.php
modules section with:
'modules' => [
...
'user' => [
'class' => 'anli\user\Module',
'adminEmails' => ['admin@email.com'],
],
],
Run the migrations files
php yii migrate/up --migrationPath=@vendor/anli/yii2-user
Update SiteController.php
with
public function actions()
{
return [
...
'login' => [
'class' => 'anli\user\actions\LoginAction',
],
'logout' => [
'class' => 'anli\user\actions\LogoutAction',
],
];
}
Add to the behaviors section of your model with:
'tenant' => [
'class' => 'anli\auth0\behaviors\TenantBehavior',
],
Add to your model query class:
class MyQuery extends \anli\user\db\ActiveQuery
...
/**
* @var string
*/
public $tableName = '{{%announcement}}';
/**
* @var boolean
*/
public $hasTenantFilter = true;
enh
Added redirect url featureenh
Added active query, behaviors for tenant filterenh
Added change tenant feature
Comments