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