Php Yii2如何根据用户类型注销用户

Php Yii2如何根据用户类型注销用户,php,yii2,yii2-basic-app,Php,Yii2,Yii2 Basic App,我想做一个特定类型的使用是注销后一定的时间和其他应保持登录,直到手动注销 之前是 'user' => [ 'class' => app\components\WebUser::class, 'identityClass' => app\modules\ecosmob\auth\models\UserMaster::class, 'enableAutoLogin' => false,

我想做一个特定类型的使用是注销后一定的时间和其他应保持登录,直到手动注销 之前是

 'user' => [
            'class' => app\components\WebUser::class,
            'identityClass' => app\modules\ecosmob\auth\models\UserMaster::class,
            'enableAutoLogin' => false,
            'loginUrl' => ['/auth/auth/login']
            ]
以及webUser.php中的以下内容

public function init()
    {
        parent::init();

        $authTimeout = (new Query())
            ->select('gwc_value')
            ->from('global_web_config')
            ->where('gwc_key = :gwc_key', ['gwc_key' => 'session_timeout'])
            ->scalar();

        if ($authTimeout) {
            $this->authTimeout = ($authTimeout * 60) - 5;
        } else {
            $this->authTimeout = AUTH_TIMEOUT_DYNAMIC;
        }
    }
main.php

Yii::$app->view->registerMetaTag(['http-equiv' => 'refresh', 'content' => Yii::$app->user->authTimeout + 5]);
我已经改变了它的功能,使所有用户自动登录,并使某些类型的用户注销使用登录持续时间,但它没有工作如下

 'user' => [
            'class' => app\components\WebUser::class,
            'identityClass' => app\modules\ecosmob\auth\models\UserMaster::class,
            'enableAutoLogin' => true,
            'loginUrl' => ['/auth/auth/login'],
            'enableSession'=>true
        ],
和at登录模型

return Yii::$app->user->login($this->getUser(),  60);

可能有不同类型的解决方案,但我想到的第一个解决方案是在注销之前对
事件作出反应。在那里,您可以检查是否要注销用户,并让注销过程完成(或不完成)。选中
yii\web\User::beforeLogout

我在Webuser中覆盖了beforeLogout,但我只想在php自动登录而不是手动登录时注销,但即使自动登录也不会触发同一事件?