original_string: public function actionUpdate($id)
      {
          $roles = ArrayHelper::map(Yii::$app->authManager->getRoles(), 'name', 'description');
          $user_permit = array_keys(Yii::$app->authManager->getRolesByUser($id));
          $user = $this->findUser($id);
          //return $this->render('view', [
          //    'user' => $user,
          //    'roles' => $roles,
          //    'user_permit' => $user_permit,
           //   'moduleName' => Yii::$app->controller->module->id
          //]);
  
  
          return $this->render('update', [
              'user' => $user,
              'roles' => $roles,
             'user_permit' => $user_permit,
             'moduleName' => Yii::$app->controller->module->id
          ]);
  
  
  /*        $user = $this->findUser($id);
  
          if ($model->load(Yii::$app->request->post()) && $model->save()) {
              return $this->redirect(['view', 'id' => $model->id]);
          } else {
              return $this->render('update', [
                  'model' => $model,
              ]);
          }
  
          //роли
          Yii::$app->authManager->revokeAll($user->getId());
          if(Yii::$app->request->post('roles')){
              foreach(Yii::$app->request->post('roles') as $role)
              {
                  $new_role = Yii::$app->authManager->getRole($role);
                  Yii::$app->authManager->assign($new_role, $user->getId());
              }
          }
          return $this->redirect(Url::to(["/".Yii::$app->controller->module->id."/user/view", 'id' => $user->getId()]));*/
      }
code: public function actionUpdate($id)
      {
          $roles = ArrayHelper::map(Yii::$app->authManager->getRoles(), 'name', 'description');
          $user_permit = array_keys(Yii::$app->authManager->getRolesByUser($id));
          $user = $this->findUser($id);
          //return $this->render('view', [
          //    'user' => $user,
          //    'roles' => $roles,
          //    'user_permit' => $user_permit,
           //   'moduleName' => Yii::$app->controller->module->id
          //]);
  
  
          return $this->render('update', [
              'user' => $user,
              'roles' => $roles,
             'user_permit' => $user_permit,
             'moduleName' => Yii::$app->controller->module->id
          ]);
  
  
  /*        $user = $this->findUser($id);
  
          if ($model->load(Yii::$app->request->post()) && $model->save()) {
              return $this->redirect(['view', 'id' => $model->id]);
          } else {
              return $this->render('update', [
                  'model' => $model,
              ]);
          }
  
          //роли
          Yii::$app->authManager->revokeAll($user->getId());
          if(Yii::$app->request->post('roles')){
              foreach(Yii::$app->request->post('roles') as $role)
              {
                  $new_role = Yii::$app->authManager->getRole($role);
                  Yii::$app->authManager->assign($new_role, $user->getId());
              }
          }
          return $this->redirect(Url::to(["/".Yii::$app->controller->module->id."/user/view", 'id' => $user->getId()]));*/
      }
code_tokens: public function actionUpdate ( $ id ) { $ roles = ArrayHelper :: map ( Yii :: $ app -> authManager -> getRoles ( ) , 'name' , 'description' ) ; $ user_permit = array_keys ( Yii :: $ app -> authManager -> getRolesByUser ( $ id ) ) ; $ user = $ this -> findUser ( $ id ) ; //return $this->render('view', [ //    'user' => $user, //    'roles' => $roles, //    'user_permit' => $user_permit, //   'moduleName' => Yii::$app->controller->module->id //]); return $ this -> render ( 'update' , [ 'user' => $ user , 'roles' => $ roles , 'user_permit' => $ user_permit , 'moduleName' => Yii :: $ app -> controller -> module -> id ] ) ; /*        $user = $this->findUser($id);
  
          if ($model->load(Yii::$app->request->post()) && $model->save()) {
              return $this->redirect(['view', 'id' => $model->id]);
          } else {
              return $this->render('update', [
                  'model' => $model,
              ]);
          }
  
          //роли
          Yii::$app->authManager->revokeAll($user->getId());
          if(Yii::$app->request->post('roles')){
              foreach(Yii::$app->request->post('roles') as $role)
              {
                  $new_role = Yii::$app->authManager->getRole($role);
                  Yii::$app->authManager->assign($new_role, $user->getId());
              }
          }
          return $this->redirect(Url::to(["/".Yii::$app->controller->module->id."/user/view", 'id' => $user->getId()]));*/ }
docstring: Updates an existing Users model.
  If update is successful, the browser will be redirected to the 'view' page.
  @param integer $id
  @return mixed
docstring_tokens: Updates an existing Users model . If update is successful the browser will be redirected to the view page .