How To Determine Admin User

hi

look at this code in the controller:


return array(

 

            array('allow',  // allow all users to perform 'index' and 'view' actions

 

                'actions'=>array('index','view','create','captcha'  ),

 

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

 

            ),

 

            array('allow', // allow authenticated user to perform 'create' and 'update' actions

 

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

 

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

 

            ),

 

 

            array('allow', // allow admin user to perform 'admin' and 'delete' actions

 

                'actions'=>array('admin','delete'),

 

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

 

            ),

 

            array('deny',  // deny all users

 

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

 

            ),

 

        );

i declared "ali" as admin user

now when a user log in, how can in know its admin or a typical user?

thanks for advice

when you will create a user with the name "ali", then ali will be the admin.

I only want to check if admin lloged in

Not by username, by permission

maybe this help: http://www.yiiframework.com/wiki/60/

you could always check if current user is ali if it is then he is admin


if (Yii::app()->user->name == 'ali')

    // he is admin

else

   // he is not admin

thanks

as i told, i dont want to check the user name

only want to check user role