Araz Jafaripur Araz Jafaripur - 1 year ago 155
PHP Question

Grant access to module in Yii2

This is possible to set permission with RBAC methods (Role, Permission) to access a module in Yii2?

I want to allow users with spacial Role to access for one of my module.

Answer Source

I use Filter for this purpose:

'modules' => [
    'roles' => [
        'class' => 'aj\admin\Module',
        'as access' => [
            'class' => 'yii\filters\AccessControl',
            'rules' => [
                    'allow' => true,
                    'roles' => ['Administrator'],
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download