mdmsoft / yii2-admin

Auth manager for Yii2 (RBAC Manager)
GNU General Public License v3.0
1.16k stars 577 forks source link

Error: "Unknown Class: ***** " on /admin/rule/create #28

Closed lujisheng closed 10 years ago

lujisheng commented 10 years ago

Hi! Thanks for your work!

I can not create a rule, it said, 'Unknown Class:*** '

Can you fix it?

Thanks!

mdmunir commented 10 years ago

Are you sure then class is exist and inherited from yii\rbac\Rule? Check the namespace and ensure autoloadable

lujisheng commented 10 years ago

not yet.

Can you give me a example?

I am using yii2-app-advance templete, have not add other component.

lujisheng commented 10 years ago

There is only one class is exist and inherited from yii\rbac\Rule.

It is 'mdm\admin\components\RouteRule'.

Is it right?

mdmunir commented 10 years ago

There is only one class is exist and inherited from yii\rbac\Rule. It is 'mdm\admin\components\RouteRule'. Is it right?

Ya. But i am not sure this will be useful for you. You should create your own Rule class. At admin/rule/create, spesify Class Name field with your Rule className. see http://www.yiiframework.com/doc-2.0/guide-authorization.html#using-rules.

lujisheng commented 10 years ago

I will try.Thank you very much!

m0zart89 commented 10 years ago

A small addition: In class name field you must enter full name of class as 'app\rbac\TestRule'.