Mohan Prasad
Mohan Prasad

Reputation: 682

Yii2 Rbac not able to add new roles

In my Yii2 project previously I had worked on rbac, set it up as in the yii2 doc click here. Now I worked on different modules and I am back on rbac. Initially set it up with just sysadmin and staff. Now I want to add a new role along with the two previous roles. Which I did it auth_item table and assigned the user_id in the auth_assignmnet table to the new role created.

In my controller added the role name for which actions he can access. But still throws Forbidden Exception. Tried different things but unable to work on it..

Any solution for this?

Upvotes: 2

Views: 359

Answers (1)

Bizley
Bizley

Reputation: 18021

First of all, you should modify RBAC structure using the provided authManager methods.

After adding new RBAC items manually in database or files you need to make sure cache is not keeping the old data.

Flush cache manually or call console method like

yii cache/flush-all

Upvotes: 3

Related Questions