Hello everyone i am new to yii frameworks…
I stuck with authManager component…
Can anyone please refer any link for how to implement authManager using DbManager
1:Most of the article say add tables to database
2:Create a role in Controller and Assign
Sample
use yii\rbac\DbManager;
$r=new DbManager;
$r->init();
$r->createRole("admin","Administrator");
$r->save();
$r->assign(‘1’,‘admin’)
but miss most of details how to implement…
so i am trying out from few days couldn’t able find any useful article of implementation
So here are thinks i need to know
1:where to write DbManager Logic in which controller
Example: i have 3 roles admin, client, guest
2:How to write Rule for this Roles
3:how and where to register these Rules to Roles
4:when user register how to access these role
5:how to write behaviors() in controller to restrict access based on role
example: how to prevent client from accessing admin controller if he access using url
like admin/index how to deny access
‘access’=>[
'class'=>AcccessControl::className(),
'only'=>['login'],
'rules'=>[
'allow'->true
'roles'=>['admin'] //here i need admin or client instead of ? or @
'denyCallBack'=>
]
]
i will be really glad if anyone share any useful link or sample code