xref: /dokuwiki/inc/Action/AbstractAclAction.php (revision 6547cfc7454f26cc353587c1314f9fde93a0a056)
164ab5140SAndreas Gohr<?php
264ab5140SAndreas Gohr
364ab5140SAndreas Gohrnamespace dokuwiki\Action;
464ab5140SAndreas Gohr
564ab5140SAndreas Gohruse dokuwiki\Action\Exception\ActionAclRequiredException;
6*6547cfc7SGerrit Uitslaguse dokuwiki\Extension\AuthPlugin;
764ab5140SAndreas Gohr
8ab583a1bSAndreas Gohr/**
9ab583a1bSAndreas Gohr * Class AbstractAclAction
10ab583a1bSAndreas Gohr *
11ab583a1bSAndreas Gohr * An action that requires the ACL subsystem to be enabled (eg. useacl=1)
12ab583a1bSAndreas Gohr *
13ab583a1bSAndreas Gohr * @package dokuwiki\Action
14ab583a1bSAndreas Gohr */
158c7c53b0SAndreas Gohrabstract class AbstractAclAction extends AbstractAction
168c7c53b0SAndreas Gohr{
1764ab5140SAndreas Gohr    /** @inheritdoc */
18d868eb89SAndreas Gohr    public function checkPreconditions()
19d868eb89SAndreas Gohr    {
20b2c9cd19SAndreas Gohr        parent::checkPreconditions();
2164ab5140SAndreas Gohr        global $conf;
22480336a3SAndreas Gohr        global $auth;
2364ab5140SAndreas Gohr        if (!$conf['useacl']) throw new ActionAclRequiredException();
24*6547cfc7SGerrit Uitslag        if (!$auth instanceof AuthPlugin) throw new ActionAclRequiredException();
2564ab5140SAndreas Gohr    }
2664ab5140SAndreas Gohr}
27