Hey community,
Today i did a composer upgrade from yii2 alpha to yii2 beta, and after read upgrade notes i resolve all my php errors.
But now i have a problema with my authorization system, i am currently using RBAC and my rbac.php file look’s like this:
<?php
use yii\rbac\Item;
$biz_rule_post_owner_id = 'return Yii::$app->user->identity->id==Yii::$app->request->post("id") || Yii::$app->user->identity->id==Yii::$app->request->get("id");';
return [
'test.index' => ['type' => Item::TYPE_OPERATION, 'description' => 'test index operation', 'bizRule' => NULL, 'data' => NULL],
'testManagement' => [
'type' => Item::TYPE_TASK,
'description' => 'test management operations',
'children' => [
'test.index'
],
'bizRule' => NULL,
'data' => NULL
],
... etc etc +200 lines.
To check user permissions i use:
$actionId = $action->id;
$controllerId = $action->controller->id;
if(Yii::$app->user->isGuest){
$this->redirect(['site/login']);
return;
}
if (!Yii::$app->user->can("$controllerId.$actionId"))
.....
I saw that rbac thing was changed, and i can’t find clean instructions to upgrade my solucion.
What is the perfect way to upgrade my code ?
Thank you.