xref: /dokuwiki/inc/Action/Admin.php (revision 8c7c53b0321a3cd3116b8d3b2ad27863a38dece7)
1<?php
2
3namespace dokuwiki\Action;
4
5use dokuwiki\Action\Exception\ActionException;
6use dokuwiki\Extension\AdminPlugin;
7
8/**
9 * Class Admin
10 *
11 * Action to show the admin interface or admin plugins
12 *
13 * @package dokuwiki\Action
14 */
15class Admin extends AbstractUserAction
16{
17
18    /** @inheritdoc */
19    public function minimumPermission() {
20        return AUTH_READ; // let in check later
21    }
22
23    /** @inheritDoc */
24    public function preProcess() {
25        global $INPUT;
26
27        // retrieve admin plugin name from $_REQUEST['page']
28        if($INPUT->str('page', '', true) != '') {
29            /** @var AdminPlugin $plugin */
30            if($plugin = plugin_getRequestAdminPlugin()) { // FIXME this method does also permission checking
31                if(!$plugin->isAccessibleByCurrentUser()) {
32                    throw new ActionException('denied');
33                }
34                $plugin->handle();
35            }
36        }
37    }
38
39    /** @inheritDoc */
40    public function tplContent() {
41        tpl_admin();
42    }
43}
44