Yii2 adminpanel authorization -


i want project`s program should this:
have divided admin 2 groups

  1. mainadmin
  2. secondadmin

1) there mainadmin , number of secondadmins. main admin can create, edit secondadmins , while creating , editing, mainadmin should able create passwords , usernames secondadmins.

2) when secondadmins login should see page.with page secondadmins can create child admins , give them own usernames , passwords.

see yii2 roles build own way restrict access , access control class

you can that:

public function behaviors() {     return [         'access' => [             'class' => accesscontrol::classname(),             'rules' => [                 [                     'allow' => true,                     'actions' => ['login', 'mainpage'],                     'roles' => ['secondadmin'],                 ],                 [                     'allow' => true,                     'roles' => ['mainadmin'],                 ],             ],         ],     ]; } 

in controller, mainadmin can action, second admin can use login , mainpage actions.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -