diff --git a/classes/admin.php b/classes/admin.php index 4b858add..0a6f07d4 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -191,7 +191,7 @@ class Admin } } - return $this->authorise(); + return $this->authorize(); } /** @@ -201,12 +201,12 @@ class Admin * * @return bool */ - public function authorise($action = 'admin.login') + public function authorize($action = 'admin.login') { $action = (array)$action; foreach ($action as $a) { - if ($this->user->authorise($a)) { + if ($this->user->authorize($a)) { return true; } } diff --git a/classes/controller.php b/classes/controller.php index 4bb1dcc4..4385ca7b 100644 --- a/classes/controller.php +++ b/classes/controller.php @@ -325,7 +325,7 @@ class AdminController */ protected function taskClearCache() { - if (!$this->authoriseTask('clear cache', ['admin.cache', 'admin.super'])) { + if (!$this->authorizeTask('clear cache', ['admin.cache', 'admin.super'])) { return; } @@ -356,7 +356,7 @@ class AdminController protected function taskBackup() { $param_sep = $this->grav['config']->get('system.param_sep', ':'); - if (!$this->authoriseTask('backup', ['admin.maintenance', 'admin.super'])) { + if (!$this->authorizeTask('backup', ['admin.maintenance', 'admin.super'])) { return; } @@ -405,7 +405,7 @@ class AdminController */ protected function taskFilterPages() { - if (!$this->authoriseTask('filter pages', ['admin.pages', 'admin.super'])) { + if (!$this->authorizeTask('filter pages', ['admin.pages', 'admin.super'])) { return; } @@ -492,7 +492,7 @@ class AdminController */ protected function taskListmedia() { - if (!$this->authoriseTask('list media', ['admin.pages', 'admin.super'])) { + if (!$this->authorizeTask('list media', ['admin.pages', 'admin.super'])) { return; } @@ -517,7 +517,7 @@ class AdminController */ protected function taskAddmedia() { - if (!$this->authoriseTask('add media', ['admin.pages', 'admin.super'])) { + if (!$this->authorizeTask('add media', ['admin.pages', 'admin.super'])) { return; } @@ -584,7 +584,7 @@ class AdminController */ protected function taskDelmedia() { - if (!$this->authoriseTask('delete media', ['admin.pages', 'admin.super'])) { + if (!$this->authorizeTask('delete media', ['admin.pages', 'admin.super'])) { return; } @@ -643,7 +643,7 @@ class AdminController */ protected function taskProcessMarkdown() { -// if (!$this->authoriseTask('process markdown', ['admin.pages', 'admin.super'])) { +// if (!$this->authorizeTask('process markdown', ['admin.pages', 'admin.super'])) { // return; // } @@ -674,7 +674,7 @@ class AdminController */ public function taskEnable() { - if (!$this->authoriseTask('enable plugin', ['admin.plugins', 'admin.super'])) { + if (!$this->authorizeTask('enable plugin', ['admin.plugins', 'admin.super'])) { return; } @@ -698,7 +698,7 @@ class AdminController */ public function taskDisable() { - if (!$this->authoriseTask('disable plugin', ['admin.plugins', 'admin.super'])) { + if (!$this->authorizeTask('disable plugin', ['admin.plugins', 'admin.super'])) { return; } @@ -722,7 +722,7 @@ class AdminController */ public function taskActivate() { - if (!$this->authoriseTask('activate theme', ['admin.themes', 'admin.super'])) { + if (!$this->authorizeTask('activate theme', ['admin.themes', 'admin.super'])) { return; } @@ -762,7 +762,7 @@ class AdminController public function taskInstall() { $type = $this->view === 'plugins' ? 'plugins' : 'themes'; - if (!$this->authoriseTask('install ' . $type, ['admin.' . $type, 'admin.super'])) { + if (!$this->authorizeTask('install ' . $type, ['admin.' . $type, 'admin.super'])) { return; } @@ -792,7 +792,7 @@ class AdminController { require_once __DIR__ . '/gpm.php'; - if (!$this->authoriseTask('install grav', ['admin.super'])) { + if (!$this->authorizeTask('install grav', ['admin.super'])) { return; } @@ -835,7 +835,7 @@ class AdminController } foreach ($permissions as $type => $p) { - if (!$this->authoriseTask('update ' . $type , $p)) { + if (!$this->authorizeTask('update ' . $type , $p)) { return; } } @@ -871,7 +871,7 @@ class AdminController public function taskUninstall() { $type = $this->view === 'plugins' ? 'plugins' : 'themes'; - if (!$this->authoriseTask('uninstall ' . $type, ['admin.' . $type, 'admin.super'])) { + if (!$this->authorizeTask('uninstall ' . $type, ['admin.' . $type, 'admin.super'])) { return; } @@ -899,7 +899,7 @@ class AdminController */ public function taskSave() { - if (!$this->authoriseTask('save', $this->dataPermissions())) { + if (!$this->authorizeTask('save', $this->dataPermissions())) { return; } @@ -1026,7 +1026,7 @@ class AdminController */ protected function taskCopy() { - if (!$this->authoriseTask('copy page', ['admin.pages', 'admin.super'])) { + if (!$this->authorizeTask('copy page', ['admin.pages', 'admin.super'])) { return; } @@ -1084,7 +1084,7 @@ class AdminController */ protected function taskReorder() { - if (!$this->authoriseTask('reorder pages', ['admin.pages', 'admin.super'])) { + if (!$this->authorizeTask('reorder pages', ['admin.pages', 'admin.super'])) { return; } @@ -1105,7 +1105,7 @@ class AdminController */ protected function taskDelete() { - if (!$this->authoriseTask('delete page', ['admin.pages', 'admin.super'])) { + if (!$this->authorizeTask('delete page', ['admin.pages', 'admin.super'])) { return; } @@ -1180,7 +1180,7 @@ class AdminController * @return bool True if the action was performed. */ protected function taskSaveas() { - if (!$this->authoriseTask('save', $this->dataPermissions())) { + if (!$this->authorizeTask('save', $this->dataPermissions())) { return; } @@ -1397,9 +1397,9 @@ class AdminController * @param array $permissions The permissions given * @return bool True if authorized. False if not. */ - protected function authoriseTask($task = '', $permissions = []) + protected function authorizeTask($task = '', $permissions = []) { - if (!$this->admin->authorise($permissions)) { + if (!$this->admin->authorize($permissions)) { if ($this->grav['uri']->extension() === 'json') $this->admin->json_response = ['status' => 'unauthorized', 'message' => $this->admin->translate('PLUGIN_ADMIN.INSUFFICIENT_PERMISSIONS_FOR_TASK') . ' ' . $task . '.']; else diff --git a/themes/grav/templates/partials/nav.html.twig b/themes/grav/templates/partials/nav.html.twig index 173feefe..675518ce 100644 --- a/themes/grav/templates/partials/nav.html.twig +++ b/themes/grav/templates/partials/nav.html.twig @@ -3,7 +3,7 @@