Skip to content

microinginer/yii2-debug-user-switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

yii2-debug-user-switch

This extension for yii2-debug. Use only development environment.

Install

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist microinginer/yii2-debug-user-switch:"dev-master"

or add

"microinginer/yii2-debug-user-switch":"dev-master"

to the require section of your composer.json file.

Configuration

// config/web.php

if (YII_ENV_DEV) {
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        ...
        'panels' => [
            'switchUser' => [
                'class' => 'microinginer\switchUser\SwitchPanel',
                'modelClass' => '\app\models\User',
                /*
                'queryCondition' => function (\yii\db\ActiveQuery &$query, \yii\db\ActiveRecord $model) {
                    $query->andWhere('suborg_id IS NOT NULL');
                },
                'gridViewColumns' => [
                    'full_name',
                    [
                        'attribute' => 'org.name',
                        'label' => 'Organization',
                    ],
                    [
                        'label' => Yii::t('app', 'Roles'),
                        'value' => function ($model) {
                            $roles = '';
                            foreach (Yii::$app->authManager->getRolesByUser($model->id) as $role) {
                                $roles .= ', ' . $role->name;
                            }
                            $roles = substr($roles, 1);
                            return $roles;
                        }
                    ],
                ],
                */
            ]
        ],
        ...
    ];
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages