I don’t understand how to redefine auth hierarchy when using CDbAuthManager (http://www.yiiframework.com/doc/guide/1.1/en/topics.auth#defining-authorization-hierarchy)
Firstly I created role client
$auth = Yii::app()->authManager;
$role = $auth->createRole('client');
After that I want to redefine roles and add new role admin
$auth = Yii::app()->authManager;
$role = $auth->createRole('client');
$role = $auth->createRole('admin');
But then I get error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'client' for key 'PRIMARY'. The SQL statement executed was: INSERT INTO `AuthItem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES (:name, :type, :description, :bizrule, :data). Bound with :name='client', :type=2, :description='', :bizrule=NULL, :data='N;'
I want to create one script that create all auth hierachy when I run it. Do I need delete all auth tables data before I run this script or there is some better solution for this?