I’m new to YII Framework. My past web development work has been using Python frameworks. I’m trying to figure out how to require login for all pages. I have started a new project with the yiic tool. However, on default all pages are accessible. I want the user to be required to login before accessing pages. Thanks in advance.
I’m fairly new too Yii as well, but I’ll give this a shot.
What I think you want to explore is the accesRules function of your controllers for each model. Here you can set rules regarding which actions such as view,update,delete, etc can be viewed by what types of users.
public function accessRules()
array('allow', // allow all users to perform 'index' and 'view' actions
array('allow', // allow authenticated user to perform 'create' and 'update' actions
array('allow', // allow admin user to perform 'admin' and 'delete' actions
array('deny', // deny all users
here is what i use. Requre login for all pages …it’s where Rohit Suthar wiki came from… his site has tons of great info. You will probably need to read the comments if you have trouble getting it to work.