Restrict an entire module

Hi!

My application has a admin module, which will act as a backoffice for content showed into the real site.

But I must put the accesControl code and rules in every controller of my module. Is there any method to restrict a entire module in one line?

(sorry for my english…)

Thanks!

Please check

Access Controle for modules

I make all module controllers inherit from an AdminController like the following:




class AdminController extends Controller

{

	...

	public function beforeAction()

	{

		$user = Yii::app()->user;

		if($user->isGuest) {

			$this->redirect(Yii::app()->user->loginUrl);

			return false;

		}	

		return true;

	}	

}

You can also implement the same logic in the beforeControllerAction method of protected/modules/admin/AdminModule.php (assuming that your module name is admin).

Choose what is more suitable in your case.