Issues (232)

app/Policies/FederationPolicy.php (6 issues)

Severity
1
<?php
2
3
namespace App\Policies;
4
5
//use Illuminate\Auth\Access\HandlesAuthorization;
6
7
use App\Federation;
8
use App\User;
9
use Illuminate\Auth\Access\HandlesAuthorization;
10
11
class FederationPolicy
12
{
13
    use HandlesAuthorization;
14
15
    /**
16
     * Create a new policy instance.
17
     * @param User $user
18
     * @param $ability
19
     * @return bool
20
     */
21 1
    public function before(User $user, $ability)
0 ignored issues
show
The parameter $ability is not used and could be removed. ( Ignorable by Annotation )

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

21
    public function before(User $user, /** @scrutinizer ignore-unused */ $ability)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23 1
        if ($user->isSuperAdmin()) {
24
            return true;
25
        }
26 1
        return null;
27
    }
28
29
    // Only SuperAdmin should be able to create Federations
30
    public function create(User $user)
0 ignored issues
show
The parameter $user is not used and could be removed. ( Ignorable by Annotation )

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

30
    public function create(/** @scrutinizer ignore-unused */ User $user)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31
    {
32
        return false;
33
    }
34
35
    // Only SuperAdmin should be able to store Federations
36
    public function store(User $user, Federation $federation)
0 ignored issues
show
The parameter $federation is not used and could be removed. ( Ignorable by Annotation )

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

36
    public function store(User $user, /** @scrutinizer ignore-unused */ Federation $federation)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $user is not used and could be removed. ( Ignorable by Annotation )

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

36
    public function store(/** @scrutinizer ignore-unused */ User $user, Federation $federation)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38
        return false;
39
    }
40
41
    // Only SuperAdmin should be able to delete Federations
42
    public function delete(User $user, Federation $federation)
0 ignored issues
show
The parameter $user is not used and could be removed. ( Ignorable by Annotation )

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

42
    public function delete(/** @scrutinizer ignore-unused */ User $user, Federation $federation)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $federation is not used and could be removed. ( Ignorable by Annotation )

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

42
    public function delete(User $user, /** @scrutinizer ignore-unused */ Federation $federation)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
    {
44
        return false;
45
    }
46
47 1
    public function edit(User $user, Federation $federation)
48
    {
49 1
        if ($user->federationOwned == null)
50 1
            return false;
51
52 1
        return $user->federationOwned->id == $federation->id;
53
    }
54
55 1
    public function update(User $user, Federation $federation)
56
    {
57 1
        if ($user->federationOwned == null)
58
            return false;
59
60 1
        return $user->federationOwned->id == $federation->id;
61
    }
62
63
64
}
65