I am working with Yii2 basic templates and working on auth_manager.
I have read about this at below link :
and i have check this also
How can we use the auth_rule table in Yii2 RBAC?
And now i know these things:
how to assign user roles.
how to assign permission to any role.
i have understand the usage of
3 tables. i.e.auth_assignment,auth_itemandauth_item_child.
Now I am not getting the usage of auth_rule table.
there are 4 columns in table
name
data
created_at
updated_at
now i am curious about
what should i need to store in these columns?
what how can i use these data later on?
I mean it is easy to understand about only two columns i.e. created_at and updated_at but what goes in name and data columns.
I did not able to find anything about it over web. so if someone know about this that will be very helpful for me and for them who also searching for same thing.
Thank You
I recommend reading this: http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#using-rules
You (probably) don't want to add data to this table manually. The
namefield will contain the name of the rule, this is also the foreign key in theauth_itemtable. Thedatacolumn will contain a serialized version of the class that actually is the rule.So, in the example from the docs, there is an AuthorRule:
The auth items and rules are connected using the authManager component:
When using the DbManager the data in the tables with automatically be populated with the correct values.