Skip to content

Commit

Permalink
Revert "Fix visibility of the method Controller::getAccessRules()"
Browse files Browse the repository at this point in the history
  • Loading branch information
luke- authored Oct 27, 2023
1 parent 59a906a commit 7a78c19
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 51 deletions.
100 changes: 50 additions & 50 deletions controllers/ConfigController.php
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
*/
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,
]);
}
}
<?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,
]);
}
}
1 change: 0 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Changelog
1.1.4 (Unreleased)
----------------------
- Enh #58: Tests for `next` version
- Fix #59: Fix visibility of the method `Controller::getAccessRules()`

1.1.3 (June 8, 2023)
--------------------
Expand Down

0 comments on commit 7a78c19

Please sign in to comment.