Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix visibility of the method Controller::getAccessRules() #6631

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ HumHub Changelog
- Enh #6512: Show error messages when DB connection configuration is invalid
- Enh #5315: Default stream sort by `created_at` instead of `id`
- Fix #6337: Update `created_at` after first publishing of content record
- Fix #6631: Fix visibility of the method `Controller::getAccessRules()`

1.15.0-beta.2 (Unreleased)
--------------------------
Expand Down
8 changes: 4 additions & 4 deletions protected/humhub/components/behaviors/AccessControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Disable guest access for all controller actions:
*
* ```php
* public function getAccessRules()
* protected function getAccessRules()
* {
* return [
* ['login']
Expand All @@ -35,7 +35,7 @@
* Disable guest access for specific controller actions:
*
* ```php
* public function getAccessRules()
* protected function getAccessRules()
* {
* return [
* ['login' => ['action1', 'action2']]
Expand All @@ -46,7 +46,7 @@
* All users have to be logged in + additional permission check for 'action1' and 'action2':
*
* ```php
* public function getAccessRules()
* protected function getAccessRules()
* {
* return [
* ['login'],
Expand All @@ -58,7 +58,7 @@
* Custom inline validator for action 'action1':
*
* ```php
* public function getAccessRules()
* protected function getAccessRules()
* {
* return [
* ['validateMyCustomRule', 'someParameter' => 'someValue', 'actions' => ['action1']]
Expand Down
2 changes: 1 addition & 1 deletion protected/humhub/controllers/OembedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class OembedController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [['login']];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AdminController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageSettings::class],
Expand Down
7 changes: 2 additions & 5 deletions protected/humhub/modules/admin/components/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,9 @@ public function behaviors()
}

/**
* Returns access rules for the standard access control behavior
*
* @return array the access permissions
* @see AccessControl
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
// Use by default ManageSettings permission if method is not overwritten by custom module
if ($this->module->id !== 'admin') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public function init()
{
$this->subLayout = '@admin/views/layouts/user';
$this->appendPageTitle(Yii::t('AdminModule.base', 'Approval'));
return parent::init();
parent::init();
}

/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
[ControllerAccess::RULE_LOGGED_IN_ONLY],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public function init()

$this->subLayout = '@admin/views/layouts/user';

return parent::init();
parent::init();
}

/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageSettings::class]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public function init()
$this->subLayout = '@admin/views/layouts/user';
$this->appendPageTitle(Yii::t('AdminModule.base', 'Groups'));

return parent::init();
parent::init();
}

/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageGroups::class],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ class InformationController extends Controller
*/
public $defaultAction = 'about';

/**
* @inheritdoc
*/
public function init()
{
$this->subLayout = '@admin/views/layouts/information';
return parent::init();
parent::init();
}

/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => \humhub\modules\admin\permissions\SeeAdminInformation::class],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public function init()
$this->appendPageTitle(Yii::t('AdminModule.base', 'Logging'));
$this->subLayout = '@admin/views/layouts/information';

return parent::init();
parent::init();
}

/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => SeeAdminInformation::class]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ public function init()
{
$this->appendPageTitle(Yii::t('AdminModule.base', 'Modules'));

return parent::init();
parent::init();
}

/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{

return [
['permissions' => [ManageModules::class]],
['permissions' => [ManageSettings::class], 'actions' => ['index', 'list']]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function init()
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use humhub\modules\admin\components\Controller;
use humhub\modules\admin\models\Log;
use humhub\modules\notification\models\forms\NotificationSettings;
use yii\base\BaseObject;

/**
* SettingController
Expand Down Expand Up @@ -65,13 +64,13 @@ public function init()
]);
$this->subLayout = '@admin/views/layouts/setting';

return parent::init();
parent::init();
}

/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageSettings::class]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public function init()
$this->subLayout = '@admin/views/layouts/space';
$this->appendPageTitle(Yii::t('AdminModule.base', 'Spaces'));

return parent::init();
parent::init();
}

/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => [ManageSpaces::class, ManageSettings::class]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function init()
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => [ManageUsers::class, ManageGroups::class]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function init()
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => [ManageSettings::class]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
use humhub\modules\admin\permissions\ManageSettings;
use humhub\modules\admin\permissions\ManageUsers;
use humhub\modules\content\components\ContentContainerDefaultPermissionManager;
use humhub\modules\content\models\ContentContainerDefaultPermission;
use humhub\modules\content\models\ContentContainerPermission;
use humhub\modules\content\models\ContentContainerSetting;
use humhub\modules\user\models\User;
use humhub\modules\user\Module;
use Yii;
use yii\db\Expression;
use yii\web\HttpException;

/**
Expand Down Expand Up @@ -47,7 +44,7 @@ public function init()
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => [ManageUsers::class]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public function init()
$this->appendPageTitle(Yii::t('AdminModule.base', 'Userprofiles'));
$this->subLayout = '@admin/views/layouts/user';

return parent::init();
parent::init();
}

/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageUsers::class]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
class CommentController extends Controller
{
/**
* @return array
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
[ControllerAccess::RULE_LOGGED_IN_ONLY => ['post', 'edit', 'delete']],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FileController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
[ControllerAccess::RULE_LOGGED_IN_ONLY => ['upload', 'delete']]
Expand Down
4 changes: 2 additions & 2 deletions protected/humhub/modules/ldap/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
class AdminController extends Controller
{
/**
* @inerhitdoc
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => [ManageSettings::class]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BrowseController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageModules::class]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LicenceController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageModules::class]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PurchaseController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageModules::class]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class UpdateController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageModules::class]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AdminController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
['permissions' => ManageSettings::class],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class EntryController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
[ControllerAccess::RULE_LOGGED_IN_ONLY]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class ListController extends Controller
{
/**
* @inheritDoc
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
[ControllerAccess::RULE_LOGGED_IN_ONLY]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OverviewController extends Controller
/**
* @inheritdoc
*/
public function getAccessRules()
protected function getAccessRules()
{
return [
[ControllerAccess::RULE_LOGGED_IN_ONLY]
Expand Down