Issues (2963)

includes/html/forms/delete-customoid.inc.php (1 issue)

1
<?php
2
3
header('Content-type: text/plain');
4
5
if (! Auth::user()->hasGlobalAdmin()) {
0 ignored issues
show
The method hasGlobalAdmin() does not exist on Illuminate\Contracts\Auth\Authenticatable. It seems like you code against a sub-type of Illuminate\Contracts\Auth\Authenticatable such as Illuminate\Foundation\Auth\User. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

5
if (! Auth::user()->/** @scrutinizer ignore-call */ hasGlobalAdmin()) {
Loading history...
6
    $response = [
7
        'status'  => 'error',
8
        'message' => 'Need to be admin',
9
    ];
10
    echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
11
    exit;
12
}
13
14
if (! is_numeric($_POST['customoid_id'])) {
15
    echo 'ERROR: No alert selected';
16
    exit;
17
} else {
18
    if (dbDelete('customoids', '`customoid_id` =  ?', [$_POST['customoid_id']])) {
19
        echo 'Custom OID has been deleted.';
20
        exit;
21
    } else {
22
        echo 'ERROR: Custom OID has not been deleted.';
23
        exit;
24
    }
25
}
26