-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix visibility of the method
Controller::getAccessRules()
- Loading branch information
1 parent
623ebaa
commit 1c41b27
Showing
2 changed files
with
51 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
<?php | ||
|
||
/** | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
* | ||
*/ | ||
|
||
namespace humhub\modules\twofa\controllers; | ||
|
||
use humhub\modules\admin\permissions\ManageModules; | ||
use humhub\modules\admin\components\Controller; | ||
use humhub\modules\twofa\helpers\TwofaHelper; | ||
use humhub\modules\twofa\models\Config; | ||
use Yii; | ||
|
||
class ConfigController extends Controller | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getAccessRules() | ||
{ | ||
return [['permissions' => ManageModules::class]]; | ||
} | ||
|
||
/** | ||
* Configuration action for system admins. | ||
*/ | ||
public function actionIndex() | ||
{ | ||
$model = new Config(); | ||
|
||
if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
$this->view->saved(); | ||
} | ||
|
||
$ip = Yii::$app->request->userIP; | ||
if ($ip !== Yii::$app->request->remoteIP) { | ||
$ip .= ', ' . Yii::$app->request->remoteIP; | ||
} | ||
|
||
return $this->render('module', [ | ||
'model' => $model, | ||
'defaultDriverName' => TwofaHelper::getDriverByClassName($model->module->defaultDriver)->name, | ||
'ip' => $ip, | ||
]); | ||
} | ||
} | ||
<?php | ||
|
||
/** | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
* | ||
*/ | ||
|
||
namespace humhub\modules\twofa\controllers; | ||
|
||
use humhub\modules\admin\permissions\ManageModules; | ||
use humhub\modules\admin\components\Controller; | ||
use humhub\modules\twofa\helpers\TwofaHelper; | ||
use humhub\modules\twofa\models\Config; | ||
use Yii; | ||
|
||
class ConfigController extends Controller | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getAccessRules() | ||
{ | ||
return [['permissions' => ManageModules::class]]; | ||
} | ||
|
||
/** | ||
* Configuration action for system admins. | ||
*/ | ||
public function actionIndex() | ||
{ | ||
$model = new Config(); | ||
|
||
if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
$this->view->saved(); | ||
} | ||
|
||
$ip = Yii::$app->request->userIP; | ||
if ($ip !== Yii::$app->request->remoteIP) { | ||
$ip .= ', ' . Yii::$app->request->remoteIP; | ||
} | ||
|
||
return $this->render('module', [ | ||
'model' => $model, | ||
'defaultDriverName' => TwofaHelper::getDriverByClassName($model->module->defaultDriver)->name, | ||
'ip' => $ip, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters