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)
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
'users'=>array('@'),
),
array('deny'),
);
}
public function actionIndex()
{
$this->render('index');
}
.............
...............
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!)