RBAC bizRule / data question

I want to attach an array of data to a role assignment and access that data from a child task’s bizRule.

For example, I want to make an assignment like this:




$role = 'roleName';

$userId = 18091;

$bizRule = null;

$data = array(

  'scope' => 'region',

  'id' => 3,

);


Yii::app()->authManager->assign($role,$userId,$bizRule,$data);



Then I want to write a bizRule at the task level that grabs data from that assignment:




$authItem = 'itemName';

$description = 'description of this item';

$bizRule = 'return Yii::app()->user->evalScope($parentRoleAssignment->data);';


Yii::app()->authManager->createTask($authItem,$description,$bizRule);



where $parentRoleAssignment-> is the data element from the parent role assignment (above) and Yii::app()->user->evalScope() is a custom function in the WebUser component.

How do I do this? I can’t find a way to call a task’s parent items in the auth class structure…???

For that matter, I can’t find any way to include the data in the bizRule associated with the same item.

For example, you create…




Yii::app()->user->authManager->assign($role,$userId,$bizRule,$data);



From what I can tell, if I want to include $data in $bizRule, I have to re-lookup the entire assignment. I’ve tried using $this->, but it invokes authManager, not this assignment instance.

Am I missing something here?

The only work-around I’ve found is to include the Item name as a parameter passed to a custom function in the bizrule. It’s better than nothing, but I was hoping there would be a more direct route.

As for the original problem of grabbing Data from Parent items, I can see why that might be a little too complex for the system. If someone knows a way, I’d love to hear about it. But I just reconceptualized the auth hierarchy from the top down, and things work better.

I moved the topic, because there are more chances to find the answer in Yii 1.1 discussions than in the old 1.0 forum :)