sasori
(Nemo Md5)
December 13, 2010, 7:47am
1
question: i have 2 different sets of login/password, 1 is the access for an actual member that can create a company + staff , and the 2nd is the access for the staff , I now have this page
those company links above has this code
<?php echo CHtml::encode($data->getAttributeLabel('CompanyName')); ?>:</b>
<?php echo CHtml::link(CHtml::encode($data->CompanyName), array('view', 'id'=>$data->CompanyID)); ?>
what’s the best thing to do in order to redirect the user to a new login area and gets back to the correct page after…
sasori
(Nemo Md5)
December 13, 2010, 10:36am
2
now i have 2 login areas
site/login
companies/login
i add this to my companies controller
public function accessRules()
{
return array(
array(
'allow',
'actions' => array('index','login'),
'users' => array('*'),
),
array(
'allow',
'actions' => array('view'),
'users' => array('@'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
but then when i click the company link based from the screen shot, I get redirected to the
default yii login area, any suggestions/comments/brain dumps how to redirect to the 2nd login area i created ?
sasori
(Nemo Md5)
December 13, 2010, 11:11am
3
fixed by adding this to the user components
'loginUrl'=>'index.php?r=companies/login',
now my new problem is, when I login as a staff, it works, but then
when i go back to the index page, and click another company where this staff doesn’t belong to,
I can also see the page
mikl
(Mike)
December 13, 2010, 11:38am
4
sasori
(Nemo Md5)
December 13, 2010, 5:36pm
5
is this correct ?
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
'loginUrl'=>array('site/login'),
),
'staffUser'=>array(
'allowAutoLogin'=>true,
'loginUrl'=>array('companies/login'),
'stateKeyPrefix'=>'staff_',
),
I based it from your example in your reply from that other thread
and am getting this error
mikl
(Mike)
December 14, 2010, 8:02am
6
It’s always good if you learn how to help yourself. So read the message carefully: It says, that you are missing the “class” element - now compare your configuration again with the example in my post. I think you should find the problem.
iivano71
(Igor Zg1987)
December 14, 2010, 8:10am
7
you using $filterchain as a object wich is not defined
EDIT: you need redeclare method fillterstuffaccess() or put in your controlerr
public $filterchain;
sasori
(Nemo Md5)
December 14, 2010, 8:13am
8
thanks, I have fixed this one, and I created a different thread for the other problem
http://www.yiiframework.com/forum/index.php?/topic/14139-removing-menu/