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    /** @inheritdoc */
19    public function minimumPermission() {
20        return AUTH_NONE;
21    }
22
23    /** @inheritdoc */
24    public function checkPreconditions() {
25        parent::checkPreconditions();
26
27        /** @var AuthPlugin $auth */
28        global $auth;
29        if(!$auth->canDo('delUser')) throw new ActionDisabledException();
30    }
31
32    /** @inheritdoc */
33    public function preProcess() {
34        global $lang;
35        if(auth_deleteprofile()) {
36            msg($lang['profdeleted'], 1);
37            throw new ActionAbort('show');
38        } else {
39            throw new ActionAbort('profile');
40        }
41    }
42
43}
44