[Module] Override Controller

Hello,

I have a module with controller/views/etc.

this module have a controller action i want to override, because i want it to have only admin access.

how can i extend this module controller ?

  • all other actions should be still used by this module controller

  • only action index should be override.

Thanks,

Idan

Hi,

please see it

Also check this

I hope it’s some help.

Hi Maggie,

this is override/extend controllers inside the application. i suspect its diffrent.

example :

myapplication/module/login_controller -> this url goes and load actionIndex in my login controller inside my module.

i do not have login controller in my project.

there for how can i extend/override it ? its inside the module.

Hi

why didn’t use a condition inside in the action that check the permissions?


if(Yii::app()->user->checkAccess('isSpecial')) {

 //todo spacial

} else {

 //todo the default

}

If the override is absolutely required then make another controller that extends the base, but you have to request to another controller


...r=yourmodule/basecontroller/index

...r=yourmodule/admincontroller/index