Hi friends,
I have some problem with accessRules.
My intention is to check the login for relevant pages.
I wrote accessRules in one controller, say AccountsController as:
public function filters() {
return array(
'accessControl', // perform access control for CRUD operations
);
}
public function accessRules() {
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions' => array('index', 'forgotpassword', 'changepassword', 'register',
'captcha', 'login', 'confirmindividualuser',
'plans', 'confirmmerge', 'accountmerged', 'plandetails', 'individualaccount', 'registrationsuccess',
'forgotpasswordsuccess', 'individualprofile', 'invalid', 'company', 'companyprofile', 'logout'),
'users' => array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array('companyprofilesuccess','changepasswordsuccess'),
'users' => array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions' => array('admin', 'delete'),
'users' => array('admin'),
),
array('deny', // deny all users
'users' => array('*'),
),
);
}
Once login I have to redirect to another method which is in SurveyController.
So I wrote as :
/**
* @return array action filters
*/
public function filters() {
return array(
'accessControl', // perform access control for CRUD operations
);
}
/**
* Specifies the access control rules.
* This method is used by the 'accessControl' filter.
* @return array access control rules
*/
public function accessRules() {
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions' => array(),
'users' => array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array('index', 'main', 'contacts', 'commercial', 'documents',
'form', 'savequestions', 'formaddsection', 'formaddquestion',
'formeditquestion', 'formdeletesection', 'formdeletequestion',
'picksection', 'pickquestion', 'preview', 'send', 'createlink'),
'users' => array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions' => array('admin', 'delete'),
'users' => array('admin'),
),
array('deny', // deny all users
'users' => array('*'),
),
);
}
Also I added the loginUrl in config file(main.php) as
'user' => array(
// enable cookie-based authentication
'allowAutoLogin' => true,
'loginUrl'=>array('accounts/login'),
),
[color="#8B0000"]
But My problem is while I type the methods in SurveyController, the browser still showing the page without checking the user login. Please give me a solution … [/color]
Thanks in advance…
Jaison