/yii2-auth

RBAC auth functionality for Yii2 framework

Primary LanguagePHP

Usage

Once the extension is installed, simply modify your application configuration as follows:

return [
    'components' => [
        ....
        'authManager' => [
            'class' => 'yii\rbac\DbManager',
            'defaultRoles' => ['public', 'authenticated'],
        ]
    ],
    'as access' => [
        'class' => 'mgcode\auth\components\AccessControl',
        'app' => 'backend',
        'allowActions' => [
            'site/error'
        ],
        'disallowActions' => [
            'disabled/action',
        ]
    ],
];

See Yii RBAC for more detail.