xref: /dokuwiki/inc/Action/ProfileDelete.php (revision 480336a332edb3421967e8a704976494c582e76c)
133551e4eSAndreas Gohr<?php
233551e4eSAndreas Gohr
333551e4eSAndreas Gohrnamespace dokuwiki\Action;
433551e4eSAndreas Gohr
533551e4eSAndreas Gohruse dokuwiki\Action\Exception\ActionAbort;
6*480336a3SAndreas Gohruse dokuwiki\Action\Exception\ActionDisabledException;
733551e4eSAndreas Gohr
833551e4eSAndreas Gohr/**
933551e4eSAndreas Gohr * Class ProfileDelete
1033551e4eSAndreas Gohr *
1133551e4eSAndreas Gohr * Delete a user account
1233551e4eSAndreas Gohr *
1333551e4eSAndreas Gohr * @package dokuwiki\Action
1433551e4eSAndreas Gohr */
1533551e4eSAndreas Gohrclass ProfileDelete extends AbstractUserAction {
1633551e4eSAndreas Gohr
1733551e4eSAndreas Gohr    /** @inheritdoc */
18ec701221SAndreas Gohr    public function minimumPermission() {
1933551e4eSAndreas Gohr        return AUTH_NONE;
2033551e4eSAndreas Gohr    }
2133551e4eSAndreas Gohr
2233551e4eSAndreas Gohr    /** @inheritdoc */
23*480336a3SAndreas Gohr    public function checkPermissions() {
24*480336a3SAndreas Gohr        parent::checkPermissions();
25*480336a3SAndreas Gohr
26*480336a3SAndreas Gohr        /** @var \DokuWiki_Auth_Plugin $auth */
27*480336a3SAndreas Gohr        global $auth;
28*480336a3SAndreas Gohr        if(!$auth->canDo('delUser')) throw new ActionDisabledException();
29*480336a3SAndreas Gohr    }
30*480336a3SAndreas Gohr
31*480336a3SAndreas Gohr    /** @inheritdoc */
3233551e4eSAndreas Gohr    public function preProcess() {
3333551e4eSAndreas Gohr        global $lang;
3433551e4eSAndreas Gohr        if(auth_deleteprofile()) {
3533551e4eSAndreas Gohr            msg($lang['profdeleted'], 1);
3633551e4eSAndreas Gohr            throw new ActionAbort('show');
3733551e4eSAndreas Gohr        } else {
3833551e4eSAndreas Gohr            throw new ActionAbort('profile');
3933551e4eSAndreas Gohr        }
4033551e4eSAndreas Gohr    }
4133551e4eSAndreas Gohr
4233551e4eSAndreas Gohr}
43