RBAC - Multiple roles per user?

Does the Yii RBAC enable a user to be assigned more than one role?

Assuming roles are set up as follows:

[color="#0000FF"]$auth->createOperation(‘addRecOff’,‘Add Receiving Officer’);

$auth->createOperation(‘enterReceivedItems’,‘Enter Quantites Received’);

$auth->createOperation(‘addReqSup’,‘Add Requisition Supervisor’);

$auth->createOperation(‘submitReq’,‘Submit a requisition’);

$auth->createOperation(‘addReqOff’,‘Add Requisition officer’);

// receivingofficer can only Enter Quantites Received



// reqofficer can only Submit a requisition



// reqsuper can do all that reqofficer can do, plus can Add Requisition officer




// manager can do all that receivingofficer and reqsuper can do, plus can Add Requisition Supervisor






If I want userA to be both a receivingofficer AND a reqofficer, can I do the following:



So that the following both return true when userA is logged in:



Or would I have to create a new role, such as:




Yes, you can and it’ll work as expected.

Btw, no offense but wouldn’t it be faster to try it instead of waiting for a reply on forum? :)

Thanks for the reply.

In regard to your question about it being faster to try it, no offence taken and here is my rationale:

I am currently evaluating various frameworks and the most important criteria for me, aside from features, is comprehensive and useful documentation along with a helpful community. Part of my evaluation process, therefore, is to attempt to learn as much as possible from the documentation and community before I actually try to use it. So I have made a list of various things I want to achieve and then have read the docs to see how easy it is to find out how to achieve them. So far, this issue is the only one I have not been able to learn that way, which gave me an opportunity to try the forum.

John the Kiwi,

Thanks for the input. It helps me thinking about how to use the authentication steps to take during a fresh install within the project.