Module Authentication

Is it possible to specify general authentication rules for a whole module? (instead of separately in each controller)

For example only authenticated (@) users should be able to access any actions within the module.

You can simply create base module controller with defaults. All your module controllers should extend it.

Actually this seems to work (in module):

public function beforeControllerAction($controller, $action)


	if(parent::beforeControllerAction($controller, $action))







		return true;



		return false;


Any problems with this approach?

You’ll not be able to create unprotected module actions (for example, login)

You can:

Yes, but I was talking about your piece of code.

So don’t forget about

!in_array($route, $publicPages)

(this is an example from your link) or something similar.