Action Authentication

Hi… I’m trying to restrict the access to certain actions to authorized users only… If the guest visits my clients/index or clients/view and is not logged in, I want to redirect the site to site/login and then bring it back to the client action…

I have implemented login part, works ok… According to the documentation, I added the following functions to my ClientController :

public function filters()


{


    return array(


        'accessControl',


    );


}





public function accessRules()


{


    return array(


        array('allow',


              'actions'=>array('index','view'),


              'users'=>array('@'),


            )


        );


}

and I added this into my config file:

'components'=>array(


	'user'=>array(


		// enable cookie-based authentication


		//'allowAutoLogin'=>true,


                    'loginUrl'=>array('site/login'),


	),

however, it doesn’t work the way I was hoping it would - it goes into accessRules method, but then continues the code in Action regardless the authorization…

can anyone help?

thanks!

Add array(‘deny’) as the last rule.

/Tommy

Tommy!!! Thank you!!!