for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Dektrium project
*
* (c) Dektrium project <http://github.com/dektrium>
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace backend\filters;
use yii\web\NotFoundHttpException;
use yii\base\ActionFilter;
/**
* BackendFilter is used to allow access only to admin and security controller in frontend when using Yii2-user with
* Yii2 advanced template.
* @author Dmitry Erofeev <[email protected]>
class BackendFilter extends ActionFilter
{
* @var array
public $controllers = ['recovery'];
* @param \yii\base\Action $action
* @return bool
* @throws \yii\web\NotFoundHttpException
public function beforeAction($action)
if (in_array($action->controller->id, $this->controllers)) {
throw new NotFoundHttpException('Not found');
}
return true;