...
|
...
|
@@ -165,14 +165,10 @@ class AdminController extends BaseController |
|
|
$allRoles = $auth->getRoles();
|
|
|
|
|
|
if (Yii::$app->request->isPost){
|
|
|
$roles = Yii::$app->request->post('roles',[]);
|
|
|
$auth->revokeAll($user_id);
|
|
|
foreach ($roles as $roleName){
|
|
|
if (empty($allRoles[$roleName])){
|
|
|
continue;
|
|
|
}
|
|
|
$role = $allRoles[$roleName];
|
|
|
$auth->assign($role,$user_id);
|
|
|
$roleName = Yii::$app->request->post('roleName');
|
|
|
if (!empty($allRoles[$roleName])){
|
|
|
$auth->revokeAll($user_id);
|
|
|
$auth->assign($allRoles[$roleName],$user_id);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -239,24 +235,24 @@ class AdminController extends BaseController |
|
|
}
|
|
|
|
|
|
if(Yii::$app->request->isPost){
|
|
|
$posts = Yii::$app->request->post();
|
|
|
$model->username = $posts['username'];
|
|
|
$model->email = $posts['email'];
|
|
|
if (!empty($posts['password'])){
|
|
|
$model->setPassword($posts['password']);
|
|
|
$post = Yii::$app->request->post();
|
|
|
$model->username = $post['username'];
|
|
|
$model->email = $post['email'];
|
|
|
if (!empty($post['password'])){
|
|
|
$model->setPassword($post['password']);
|
|
|
$model->generateAuthKey();
|
|
|
$model->generatePasswordResetToken();
|
|
|
}
|
|
|
|
|
|
if($model->save()){
|
|
|
if (!empty($posts['password'])){
|
|
|
Yii::$app->session->setFlash('success', '密码修改成功。');
|
|
|
if (!empty($post['password'])){
|
|
|
Yii::$app->session->setFlash('info', '密码修改成功。');
|
|
|
}
|
|
|
Yii::$app->session->setFlash('success', '编辑成功。');
|
|
|
}else{
|
|
|
Yii::$app->session->setFlash('warning', current($model->getFirstErrors()));
|
|
|
}
|
|
|
return $this->refresh();
|
|
|
//return $this->refresh();
|
|
|
}
|
|
|
|
|
|
return $this->render('adminedit',[
|
...
|
...
|
@@ -281,9 +277,9 @@ class AdminController extends BaseController |
|
|
}
|
|
|
|
|
|
if(Yii::$app->request->isPost){
|
|
|
$posts = Yii::$app->request->post();
|
|
|
$model->name = $posts['name'];
|
|
|
$model->description = $posts['description'];
|
|
|
$post = Yii::$app->request->post();
|
|
|
$model->name = $post['name'];
|
|
|
$model->description = $post['description'];
|
|
|
|
|
|
if($this->authManager->update($name,$model)){
|
|
|
Yii::$app->session->setFlash('success', '编辑成功。');
|
...
|
...
|
@@ -315,9 +311,9 @@ class AdminController extends BaseController |
|
|
}
|
|
|
|
|
|
if(Yii::$app->request->isPost){
|
|
|
$posts = Yii::$app->request->post();
|
|
|
$model->name = $posts['name'];
|
|
|
$model->description = $posts['description'];
|
|
|
$post = Yii::$app->request->post();
|
|
|
$model->name = $post['name'];
|
|
|
$model->description = $post['description'];
|
|
|
|
|
|
if($this->authManager->update($name,$model)){
|
|
|
Yii::$app->session->setFlash('success', '编辑成功。');
|
...
|
...
|
|