h3rm
July 5, 2011, 1:36am
1
I want to make accessRules on the controller, and I tried the demo blog.
I want action not open the contact is opened by a user who is logged.
this is mine in accessRules action:
public function accessRules()
{
return array(
array('deny',
'actions'=>array('contact'),
'users'=>array('@'),
),
);
}
and the code can not run.
bettor
(Live Webscore)
July 5, 2011, 1:54pm
3
I want to make accessRules on the controller, and I tried the demo blog.
I want action not open the contact is opened by a user who is logged.
this is mine in accessRules action:
public function accessRules()
{
return array(
array('deny',
'actions'=>array('contact'),
'users'=>array('@'),
),
);
}
and the code can not run.
with that code you are forbiding all authorized users to access your contact action. Are you able to access the contact page given the above accessRule?
h3rm
July 5, 2011, 2:16pm
4
the code above are simply examples, to test whether accessRules function. and there’s no effect. whether it is related to login, roles?
I am very happy if there is a reference that I can learn more about.
phtamas
(Phtamas)
July 5, 2011, 5:51pm
5
the code above are simply examples, to test whether accessRules function. and there’s no effect. whether it is related to login, roles?
I am very happy if there is a reference that I can learn more about.
Did you enable access controll filter in filters() method?
bettor
(Live Webscore)
July 5, 2011, 7:32pm
6
the code above are simply examples, to test whether accessRules function. and there’s no effect. whether it is related to login, roles?
I am very happy if there is a reference that I can learn more about.
before this method you should have
public function filters()
{
return array(
'accessControl',
);
}
h3rm
July 6, 2011, 1:05am
7
thanks, very helpful
I’ve added the above code and have an influential effect.
whether the following message indicates that accessRules running correctly.
i tried to open contact : http://localhost/yii/demos/blog/index.php/site/contact
and get message:
Error 403
You are not authorized to perform this action.
whether accessControl can be replaced with another statement, or it must be written exactly like that?