xref: /dokuwiki/inc/Action/ProfileDelete.php (revision 8c7c53b0321a3cd3116b8d3b2ad27863a38dece7)
1<?php
2
3namespace dokuwiki\Action;
4
5use dokuwiki\Action\Exception\ActionAbort;
6use dokuwiki\Action\Exception\ActionDisabledException;
7use dokuwiki\Extension\AuthPlugin;
8
9/**
10 * Class ProfileDelete
11 *
12 * Delete a user account
13 *
14 * @package dokuwiki\Action
15 */
16class ProfileDelete extends AbstractUserAction
17{
18
19    /** @inheritdoc */
20    public function minimumPermission() {
21        return AUTH_NONE;
22    }
23
24    /** @inheritdoc */
25    public function checkPreconditions() {
26        parent::checkPreconditions();
27
28        /** @var AuthPlugin $auth */
29        global $auth;
30        if(!$auth->canDo('delUser')) throw new ActionDisabledException();
31    }
32
33    /** @inheritdoc */
34    public function preProcess() {
35        global $lang;
36        if(auth_deleteprofile()) {
37            msg($lang['profdeleted'], 1);
38            throw new ActionAbort('show');
39        } else {
40            throw new ActionAbort('profile');
41        }
42    }
43}
44