accessRules with not integrated Yii-Login

Is it ok to do like that:




public function accessRules()

{

            //here goes rules for everybody ..


            if($this->isConnected()) { //my function to check if user connected. But he is not Logged throw Yii-Login


                $accessRules = array(

                    array('allow',

                        'actions'=>array(

                                         'action1','action11'

                                         ),

                        'users'=>array('*'),

                    ),

                );


            }

            else {


                $accessRules = array(            

                    array('allow',

                        'actions'=>array(

                                         'action3','action4'

                                         ),

                        'roles'=>array('@'), //Yii-Login authenticated user

                    )

                );


            }

            

            return $accessRules;

	  }



Or there is some other (better) way to implement this.

Why you do not just one array as docs write?

cause i have too login types. One is for those who use yii bult-in login system and others who use 3rd site logins (like facebook Connect, but fr now its other site, no facebook). And there is different rules for each login type… im going to simplify this, but for now this is it.

What about return just the second array?What is the differrent?

if you confused about action names (action1,action2…) - don’t. these are just examples.

Difference is when user is Logged with yii login form, when he (for example) can add users.

If he is logged/connected throw 3rd party sites (facebook) there is used only session data, when he can’t ad users, but just add some comments.

So why not using sometnig like this


public function accessRules() {

return array(


        array('allow',

        'actions'=>array('test','Logout'),

        'users'=>array('*'),

        ),

        array('allow',

        'actions'=>array('Users'),

        'users'=>array('@'),

        ),

 array('allow',

        'actions'=>array('some'),        

        'expression'=>"$_SESSION['TEST']==0",

       ....

        ),

}

ok, didn’t know that. Thanks ;) it totaly better