johnitvn / yii2-rbac-plus

Database role base access control manager for yii2
49 stars 52 forks source link

Facing Issues while creating a Rule #13

Open abdulquddus opened 9 years ago

abdulquddus commented 9 years ago

Hi, Sorry could be a silly question. This is my first time to use RBAC in any YII2 project. I want to ask is what is the class name in the RULEs. As what ever I give to it got every class does not exist. rules issue Hope you won't mind of this silly question as I'm a learner. Thanks in advance.

michaelnguyen2021 commented 9 years ago

You have to create class first before you can use it as rule . Read more ( http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#using-rules)

abdulquddus commented 9 years ago

I have created a class in backend\rbac folder with the name of ItemRules. Now when I create a Rule and give the classname as \backend\rbac\itemrules get the following error.

error 2

Keep in mind that this rbac folder is separated from the one in the vendor folder. secondl y I gave namespace to backend\rbac at the top of the itemRules.php file. What am i doing wrong.

Goancona commented 8 years ago

Have you solvedd this? I have the same issue D:

abdulquddus commented 8 years ago

Yes I've been able to solve the problem by creating a folder in the backend named it rbac. Then I have added all the rules one by one in that folder. When tried to create the rule "backend\rbac\AuthorRule" given this in the class name without quotes.