Completed
Push — master ( 13ce47...b2c9cd )
by Andreas
10:39 queued 06:48
created

ProfileDelete   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 4

3 Methods

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