diff --git a/_test/tests/inc/Action/general.test.php b/_test/tests/inc/Action/general.test.php index 5e6402836f9a386cb9f4b0d493c0e833c49c6f5b..9aacfbf96bb15416ca4186c6298134fd7bc380c7 100644 --- a/_test/tests/inc/Action/general.test.php +++ b/_test/tests/inc/Action/general.test.php @@ -133,7 +133,7 @@ class action_general extends DokuWikiTest { $conf['subscribers'] = 1; try { - $class->checkPermissions(); + $class->checkPreconditions(); } catch(\Exception $e) { $this->assertNotSame(ActionAclRequiredException::class, get_class($e)); } @@ -141,7 +141,7 @@ class action_general extends DokuWikiTest { $conf['useacl'] = 0; try { - $class->checkPermissions(); + $class->checkPreconditions(); } catch(\Exception $e) { $this->assertSame(ActionAclRequiredException::class, get_class($e)); } @@ -166,7 +166,7 @@ class action_general extends DokuWikiTest { $_SERVER['REMOTE_USER'] = 'test'; try { - $class->checkPermissions(); + $class->checkPreconditions(); } catch(\Exception $e) { $this->assertNotSame(ActionUserRequiredException::class, get_class($e)); } @@ -174,7 +174,7 @@ class action_general extends DokuWikiTest { unset($_SERVER['REMOTE_USER']); try { - $class->checkPermissions(); + $class->checkPreconditions(); } catch(\Exception $e) { $this->assertSame(ActionUserRequiredException::class, get_class($e)); } diff --git a/inc/Action/AbstractAclAction.php b/inc/Action/AbstractAclAction.php index 76639b066da392b7f623327b51bc2a22505641f1..871edb0ae5dd750c76b747b5cba0294b30aeb648 100644 --- a/inc/Action/AbstractAclAction.php +++ b/inc/Action/AbstractAclAction.php @@ -14,8 +14,8 @@ use dokuwiki\Action\Exception\ActionAclRequiredException; abstract class AbstractAclAction extends AbstractAction { /** @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); global $conf; global $auth; if(!$conf['useacl']) throw new ActionAclRequiredException(); diff --git a/inc/Action/AbstractAction.php b/inc/Action/AbstractAction.php index 8c2467f86d54e1222419613d843bda388331f208..ea862386eb6066c48f013f024443c7e6981a0b42 100644 --- a/inc/Action/AbstractAction.php +++ b/inc/Action/AbstractAction.php @@ -44,12 +44,12 @@ abstract class AbstractAction { abstract public function minimumPermission(); /** - * Check permissions are correct to run this action + * Check conditions are met to run this action * * @throws ActionException * @return void */ - public function checkPermissions() { + public function checkPreconditions() { } /** diff --git a/inc/Action/AbstractUserAction.php b/inc/Action/AbstractUserAction.php index 8a3a19f75c4f6d888b81bd2eac050f70aad65b2d..b4e3f1a4d995e0fc6ba0196a230b8f642d3bbfc8 100644 --- a/inc/Action/AbstractUserAction.php +++ b/inc/Action/AbstractUserAction.php @@ -14,8 +14,8 @@ use dokuwiki\Action\Exception\ActionUserRequiredException; abstract class AbstractUserAction extends AbstractAclAction { /** @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); global $INPUT; if(!$INPUT->server->str('REMOTE_USER')) { throw new ActionUserRequiredException(); diff --git a/inc/Action/Admin.php b/inc/Action/Admin.php index b1f9095ee59c0d345801cabb1a5ae7d3cab2107f..8d43057888fdd26c00e55f5cdc40bedcee954796 100644 --- a/inc/Action/Admin.php +++ b/inc/Action/Admin.php @@ -24,8 +24,8 @@ class Admin extends AbstractUserAction { } } - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); global $INFO; if(!$INFO['ismanager']) { diff --git a/inc/Action/Draft.php b/inc/Action/Draft.php index ab678c2942eda21c13ddfe763cc3d1e78dfb8feb..caf08701170cf3ce2d8a948d7427a1e27a6746f6 100644 --- a/inc/Action/Draft.php +++ b/inc/Action/Draft.php @@ -25,8 +25,8 @@ class Draft extends AbstractAction { } /** @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); global $INFO; if(!file_exists($INFO['draft'])) throw new ActionException('edit'); } diff --git a/inc/Action/Edit.php b/inc/Action/Edit.php index 7483516811ccd85e9315846921540a0aae19a2c9..061c9e2ca3b0e1d6886ce848b3a8e314f23f8a05 100644 --- a/inc/Action/Edit.php +++ b/inc/Action/Edit.php @@ -26,8 +26,8 @@ class Edit extends AbstractAction { /** * @inheritdoc falls back to 'source' if page not writable */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); global $INFO; // no edit permission? view source diff --git a/inc/Action/Login.php b/inc/Action/Login.php index 6e4aeb01ab2900515fb6331f65f9ac7e571852a2..7f903ff2de3875be3e755e385657e4d3977a66a5 100644 --- a/inc/Action/Login.php +++ b/inc/Action/Login.php @@ -19,9 +19,9 @@ class Login extends AbstractAclAction { } /** @inheritdoc */ - public function checkPermissions() { + public function checkPreconditions() { global $INPUT; - parent::checkPermissions(); + parent::checkPreconditions(); if($INPUT->server->has('REMOTE_USER')) { // nothing to do throw new ActionException(); diff --git a/inc/Action/Logout.php b/inc/Action/Logout.php index 2abf968f6203952d52c9fa0f7b14c2f4c5ee24aa..159090423eb43e9816ddcd0888891642bf067a1d 100644 --- a/inc/Action/Logout.php +++ b/inc/Action/Logout.php @@ -20,8 +20,8 @@ class Logout extends AbstractUserAction { } /** @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); /** @var \DokuWiki_Auth_Plugin $auth */ global $auth; diff --git a/inc/Action/Profile.php b/inc/Action/Profile.php index 1ebe51fec700a7f0d3db52b28ab1935609671e78..53d8d2ff361aa42ed19c515003bb53e787e7cbc9 100644 --- a/inc/Action/Profile.php +++ b/inc/Action/Profile.php @@ -20,8 +20,8 @@ class Profile extends AbstractUserAction { } /** @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); /** @var \DokuWiki_Auth_Plugin $auth */ global $auth; diff --git a/inc/Action/ProfileDelete.php b/inc/Action/ProfileDelete.php index 5be5ff57870660f06e5c0ed5ae97edbe2b2eb269..995f813949f8bbb72faf1f8c7ead86bb22b5cd38 100644 --- a/inc/Action/ProfileDelete.php +++ b/inc/Action/ProfileDelete.php @@ -20,8 +20,8 @@ class ProfileDelete extends AbstractUserAction { } /** @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); /** @var \DokuWiki_Auth_Plugin $auth */ global $auth; diff --git a/inc/Action/Register.php b/inc/Action/Register.php index c97d3f8582d0f0f6c6f9467c17476a1fe47e3051..0d5415868d003ab3a222d7d86e113ea56a9df22e 100644 --- a/inc/Action/Register.php +++ b/inc/Action/Register.php @@ -20,8 +20,8 @@ class Register extends AbstractAclAction { } /** @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); /** @var \DokuWiki_Auth_Plugin $auth */ global $auth; diff --git a/inc/Action/Resendpwd.php b/inc/Action/Resendpwd.php index 80f05e05625ed1eb0df841c51a5e7f3b7266b22b..ab243b0425f4093aebf32959abb9b8408b2d83c3 100644 --- a/inc/Action/Resendpwd.php +++ b/inc/Action/Resendpwd.php @@ -20,8 +20,8 @@ class Resendpwd extends AbstractAclAction { } /** @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); /** @var \DokuWiki_Auth_Plugin $auth */ global $auth; diff --git a/inc/Action/Search.php b/inc/Action/Search.php index aa19671da04ac6259fdf727858121e86e8ee1c9f..382fc47e61c2e2d6a811b3372ea2c9774539e8cf 100644 --- a/inc/Action/Search.php +++ b/inc/Action/Search.php @@ -27,8 +27,8 @@ class Search extends AbstractAction { * * @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); } public function preProcess() diff --git a/inc/Action/Subscribe.php b/inc/Action/Subscribe.php index 94920c428784dc332abf2d557da296647eec6ece..c16571022a82f383e3b079dae7597563c61d1912 100644 --- a/inc/Action/Subscribe.php +++ b/inc/Action/Subscribe.php @@ -20,8 +20,8 @@ class Subscribe extends AbstractUserAction { } /** @inheritdoc */ - public function checkPermissions() { - parent::checkPermissions(); + public function checkPreconditions() { + parent::checkPreconditions(); global $conf; if(isset($conf['subscribers']) && !$conf['subscribers']) throw new ActionDisabledException(); diff --git a/inc/ActionRouter.php b/inc/ActionRouter.php index 7e6fddd16ec10a3925e1b68db75c8cd75703892c..edc45cfc40ca6e815b86f6b344c1cfa82bf91e5b 100644 --- a/inc/ActionRouter.php +++ b/inc/ActionRouter.php @@ -204,7 +204,7 @@ class ActionRouter { throw new ActionDisabledException(); } - $action->checkPermissions(); + $action->checkPreconditions(); if(isset($INFO)) { $perm = $INFO['perm'];