login authentication in entire website in blog

Hello All,

i am new in yii and i am trying to learn from forum and different topic. my question is how can i add user model authentication for blog sentire section (only authenticated user and use it). eg. in blog system only logged in user can view all the pages like about, contact and index (site/index). when someone access without authenticate it will redirect on site/login(login form)

Thanks in advance…

You may want to check Larry Ullman’s post

Hello tellibus,

thanks for your reply…

no its not working for me i made simple setup provide by yii framework with Simple Authentication provide by larryullman simple authentication in yii

Ok, maybe you haven’t set up the access rules in your controllers? You don’t want to allow ‘*’ anywhere, at least ‘@’ (logged users).

Hello tellibus,

ya i added access rules in my SiteController.php from Configure controller in yii link :

class SiteController extends Controller


public function filters()


        return array( 'accessControl' ); 


	public function accessRules()


    	return array(

        		array('allow', // allow authenticated users to access all actions






public function actionIndex()







beats me…

Well I also have




in config/main.php

instead of the default true value that enables cookie-based authentication.

Also, before testing, have you logged out before re-testing? Sorry if that sounds stupid but hey these things occurred to me during my first steps in Yii (hopefully always learning anyway!)

ya its working now thank you very much…