Skip to content
Snippets Groups Projects
Commit b2c9cd19 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

renamed ActionRouter::checkPermissions to checkPreconditions

As discussed in #1933
parent 13ce475d
No related branches found
No related tags found
No related merge requests found
......@@ -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));
}
......
......@@ -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();
......
......@@ -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() {
}
/**
......
......@@ -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();
......
......@@ -24,8 +24,8 @@ class Admin extends AbstractUserAction {
}
}
public function checkPermissions() {
parent::checkPermissions();
public function checkPreconditions() {
parent::checkPreconditions();
global $INFO;
if(!$INFO['ismanager']) {
......
......@@ -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');
}
......
......@@ -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
......
......@@ -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();
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -27,8 +27,8 @@ class Search extends AbstractAction {
*
* @inheritdoc
*/
public function checkPermissions() {
parent::checkPermissions();
public function checkPreconditions() {
parent::checkPreconditions();
}
public function preProcess()
......
......@@ -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();
......
......@@ -204,7 +204,7 @@ class ActionRouter {
throw new ActionDisabledException();
}
$action->checkPermissions();
$action->checkPreconditions();
if(isset($INFO)) {
$perm = $INFO['perm'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment