Rename a role

Hi

How can I rename a role in RBAC, there are create and update methods, but for rename there is nothing.

thanks in advance.

Usually you can not rename a role (or any other RBAC item). Once it is created, it will be referred to by other items using its name. And the name is also used in PHP code, for example, ‘Yii::$app->user->can(“rolename”)’. It’s very hard to rename a role without breaking consistency.

So, you have to be careful when you name RBAC items. And I would recommend you to build your RBAC hierarchy using "migration". It will help you to maintain your RBAC structure in a better fashion by providing a safe way to undo/redo constructing RBAC hierarchy.