how to set permissions for groups instead of users in rbac?

I want the following:

an user has a group

the assignment of the authorization is to the group, instead of user


anyway to accomplish that using the yii’s default rbac ?

Yes, it’s actually pretty straight forward.

Create Role "groupname" and assign the user to groupname.

Now, create Task or Operation "SomeAssignment" and then add groupname as a child of "SomeAssignment".

Your user now has access to the SomeAssignment Task.

So it would look something like this:




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


$auth->createRole('author');


$create = $auth->createOperation('createPost');

$create->addChild('author');



Then simply assign the user the role of author.




$auth->assign('author', $userid);



Its exactly what I needed

Thank you very much, Dana

You’re welcome =)