Setting User Role (Admin/user) In Yii

How can I set the user’s role after I login him/her with

Yii::app()->user->login($identity, 0);


What I’m asking is how/what does this rule do to check if the user is logged in (@) and is administrator (admin)?

Code in a random controller:

public function accessRules()


    return array(














@ is the special symbol that was recognized by Yii to identify authenticated users.

? is used to identify unauthorized users

other than @ and ? are considered to be the name of the currently logged in users. so here admin is the name of the user who will holds the permission to do admin and delete actions in your controller.