Authorization Hierarchy Code

Hi All,

Every Forum topic and/or doc or blog on authorization heirarchy say:

Run following code once in by placing it an any executabel file of your yii web app:

$auth=Yii::app()->authManager;

$bizRule=‘return !Yii::app()->user->isGuest;’;

$auth->createRole(‘authenticated’, ‘authenticated user’, $bizRule);

$bizRule=‘return Yii::app()->user->isGuest;’;

$auth->createRole(‘guest’, ‘guest user’, $bizRule);

$role = $auth->createRole(‘admin’, ‘administrator’);

$auth->assign(‘admin’,1); // adding admin to first user created

$auth->save();

I actually dont get where to put this code and execute. Do i need to execute this from shell. Is there a way i can run this from browser coz i dont have shell access on server.

I tried by putting the above code in protected/view/user/auth.php and tried to run it as http://localhost/yii/test/index.php?r=user/auth. It returns me with Error 404.

Pl help let me know where to place and the above code and how to execute it.

Solved : http://www.yiiframework.com/forum/index.php/topic/44894-creating-authorization-roles/