...
|
...
|
@@ -24,6 +24,27 @@ class AdminController extends BaseController |
|
|
*/
|
|
|
public function actionList()
|
|
|
{
|
|
|
if (Yii::$app->request->isPost){
|
|
|
$model = new Admin;
|
|
|
$model->username = Yii::$app->request->post('username');
|
|
|
$model->email = Yii::$app->request->post('email');
|
|
|
$model->setPassword(Yii::$app->request->post('password'));
|
|
|
$model->generateAuthKey();
|
|
|
$model->generatePasswordResetToken();
|
|
|
|
|
|
if ($model->save()){
|
|
|
if (($roleName = Yii::$app->request->post('role')) && ($role = $this->authManager->getRole($roleName))){
|
|
|
if (!$this->authManager->assign($role,$model->getId())){
|
|
|
Yii::$app->session->setFlash('error', '分配用户组失败。');
|
|
|
}
|
|
|
}
|
|
|
Yii::$app->session->setFlash('success', '加入成功。');
|
|
|
}else{
|
|
|
//Yii::$app->session->setFlash('error', '加入失败。');
|
|
|
Yii::$app->session->setFlash('warning', current($model->getFirstErrors()));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$list = Admin::find()->all();
|
|
|
|
|
|
//所有权限
|
...
|
...
|
|