xref: /dokuwiki/inc/Menu/Item/Admin.php (revision dbe59455235b2af2367275ece5f0ec6ba6f1b6b2)
193b8c351SAndreas Gohr<?php
293b8c351SAndreas Gohr
393b8c351SAndreas Gohrnamespace dokuwiki\Menu\Item;
493b8c351SAndreas Gohr
5368ce258SAndreas Gohr/**
6368ce258SAndreas Gohr * Class Admin
7368ce258SAndreas Gohr *
8368ce258SAndreas Gohr * Opens the Admin screen. Only shown to managers or above
9368ce258SAndreas Gohr */
1033b91513SAndreas Gohrclass Admin extends AbstractItem
1133b91513SAndreas Gohr{
1293b8c351SAndreas Gohr    /** @inheritdoc */
1333b91513SAndreas Gohr    public function __construct()
1433b91513SAndreas Gohr    {
15*dbe59455SAndreas Gohr        global $INPUT;
16*dbe59455SAndreas Gohr        global $INFO;
17*dbe59455SAndreas Gohr
1893b8c351SAndreas Gohr        parent::__construct();
1993b8c351SAndreas Gohr
20*dbe59455SAndreas Gohr        if (!$INPUT->server->str('REMOTE_USER')) {
21*dbe59455SAndreas Gohr            throw new \RuntimeException("admin is only for logged in users");
2293b8c351SAndreas Gohr        }
233d90b12cSAndreas Gohr
24*dbe59455SAndreas Gohr        if (!isset($INFO) || !$INFO['ismanager']) {
25*dbe59455SAndreas Gohr            throw new \RuntimeException("admin is only for managers and above");
26*dbe59455SAndreas Gohr        }
273d90b12cSAndreas Gohr
28*dbe59455SAndreas Gohr        $this->svg = DOKU_INC . 'lib/images/menu/settings.svg';
2993b8c351SAndreas Gohr    }
3093b8c351SAndreas Gohr}
31