AccessRules does not work ?

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(







and the code can not run.

hello :)

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?

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?

before this method you should have

public function filters()


        return array(




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?