anli/yii2-user Yii 2.0 user management extension

extension

anli\user

Yii 2.0 user management extension

Installation

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.

Installation

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',
        ],
    ];
}

Auto update tenant,

Add to the behaviors section of your model with:

'tenant' => [
    'class' => 'anli\auth0\behaviors\TenantBehavior',
],

Enable tenant filter

Add to your model query class:

class MyQuery extends \anli\user\db\ActiveQuery
...
    /**
     * @var string
     */
    public $tableName = '{{%announcement}}';

    /**
     * @var boolean
     */
    public $hasTenantFilter = true;

Changelog

CHANGELOG

2.0.0 [27 Jan 2016]

  • enh Added redirect url feature
  • enh Added active query, behaviors for tenant filter
  • enh Added change tenant feature

1.0.0 [12 Jan 2016]

  • Initial release

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



2.0.0 is the latest of 2 releases



MIT license
Stats
0 github stars & 0 github forks
0 downloads in the last day
0 downloads in the last 30 days
5 total downloads