芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/airport-back/vendor/yiisoft/yii2-debug/src/controllers/UserController.php
* @since 2.0.10 */ class UserController extends Controller { /** * {@inheritdoc} * @throws BadRequestHttpException */ public function beforeAction($action) { Yii::$app->response->format = Response::FORMAT_JSON; if (!Yii::$app->session->hasSessionId) { throw new BadRequestHttpException('Need an active session'); } return parent::beforeAction($action); } /** * Set new identity, switch user * @return \yii\web\User * @throws \yii\base\InvalidConfigException */ public function actionSetIdentity() { $user_id = Yii::$app->request->post('user_id'); $userSwitch = new UserSwitch(); $newIdentity = Yii::$app->user->identity->findIdentity($user_id); $userSwitch->setUserByIdentity($newIdentity); return Yii::$app->user; } /** * Reset identity, switch to main user * @return \yii\web\User * @throws \yii\base\InvalidConfigException */ public function actionResetIdentity() { $userSwitch = new UserSwitch(); $userSwitch->reset(); return Yii::$app->user; } }