skeeks\cms\filters\CmsAccessControl::denyAccess PHP Method

denyAccess() protected method

The default implementation will redirect the user to the login page if he is a guest; if the user is already logged, a 403 HTTP exception will be thrown.
protected denyAccess ( User $user )
$user yii\web\User the current user
    protected function denyAccess($user)
    {
        $rr = new RequestResponse();
        if ($user->getIsGuest()) {
            $authUrl = UrlHelper::construct(["/cms/auth/login"])->setCurrentRef()->createUrl();
            if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
                \Yii::$app->getResponse()->redirect($authUrl);
                $rr->redirect = $authUrl;
                return (array) $rr;
            } else {
                \Yii::$app->getResponse()->redirect($authUrl);
            }
        } else {
            throw new ForbiddenHttpException(\Yii::t('yii', 'You are not allowed to perform this action.'));
        }
    }
CmsAccessControl