Yii2 adminpanel authorization -
i want project`s program should this:
have divided admin 2 groups
- mainadmin
- 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
Post a Comment