1<?php 2/** 3 * Created by IntelliJ IDEA. 4 * User: andi 5 * Date: 2/11/17 6 * Time: 11:33 AM 7 */ 8 9namespace dokuwiki\Action; 10 11use dokuwiki\Action\Exception\ActionException; 12 13class Admin extends AbstractUserAction { 14 15 /** @inheritdoc */ 16 function minimumPermission() { 17 global $INFO; 18 19 if($INFO['ismanager']) { 20 return AUTH_READ; // let in check later 21 } else { 22 return AUTH_ADMIN; 23 } 24 } 25 26 public function checkPermissions() { 27 parent::checkPermissions(); 28 29 global $INFO; 30 if(!$INFO['ismanager']) { 31 throw new ActionException('denied'); 32 } 33 } 34 35 public function preProcess() { 36 global $INPUT; 37 global $INFO; 38 39 // retrieve admin plugin name from $_REQUEST['page'] 40 if (($page = $INPUT->str('page', '', true)) != '') { 41 /** @var $plugin \DokuWiki_Admin_Plugin */ 42 if ($plugin = plugin_getRequestAdminPlugin()){ // FIXME this method does also permission checking 43 if($plugin->forAdminOnly() && !$INFO['isadmin'] ) { 44 throw new ActionException('denied'); 45 } 46 $plugin->handle(); 47 } 48 } 49 } 50 51 public function tplContent() { 52 tpl_admin(); 53 } 54 55} 56