Passed
Push — dev6 ( e24a5d...ab8d6f )
by Ron
20:36
created

UserRolesPolicy   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 92
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 10
c 1
b 0
f 0
dl 0
loc 92
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A view() 0 4 1
A delete() 0 4 1
A viewAny() 0 4 1
A create() 0 4 1
A restore() 0 4 1
A update() 0 4 1
A forceDelete() 0 4 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\User;
6
use App\Models\UserRoles;
7
use App\Traits\AllowTrait;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class UserRolesPolicy
11
{
12
    use HandlesAuthorization;
13
    use AllowTrait;
1 ignored issue
show
introduced by
The trait App\Traits\AllowTrait requires some properties which are not provided by App\Policies\UserRolesPolicy: $role_id, $username, $allow
Loading history...
14
15
    /**
16
     * Determine whether the user can view any models.
17
     *
18
     * @param  \App\Models\User  $user
19
     * @return \Illuminate\Auth\Access\Response|bool
20
     */
21
    public function viewAny(User $user)
22
    {
23
        //
24
        return $this->checkPermission($user, 'Manage Permissions');
25
    }
26
27
    /**
28
     * Determine whether the user can view the model.
29
     *
30
     * @param  \App\Models\User  $user
31
     * @param  \App\Models\UserRoles  $userRoles
32
     * @return \Illuminate\Auth\Access\Response|bool
33
     */
34
    public function view(User $user, UserRoles $userRoles)
0 ignored issues
show
Unused Code introduced by
The parameter $userRoles 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

34
    public function view(User $user, /** @scrutinizer ignore-unused */ UserRoles $userRoles)

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...
35
    {
36
        //
37
        return $this->checkPermission($user, 'Manage Permissions');
38
    }
39
40
    /**
41
     * Determine whether the user can create models.
42
     *
43
     * @param  \App\Models\User  $user
44
     * @return \Illuminate\Auth\Access\Response|bool
45
     */
46
    public function create(User $user)
47
    {
48
        //
49
        return $this->checkPermission($user, 'Manage Permissions');
50
    }
51
52
    /**
53
     * Determine whether the user can update the model.
54
     *
55
     * @param  \App\Models\User  $user
56
     * @param  \App\Models\UserRoles  $userRoles
57
     * @return \Illuminate\Auth\Access\Response|bool
58
     */
59
    public function update(User $user, UserRoles $userRoles)
0 ignored issues
show
Unused Code introduced by
The parameter $userRoles 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

59
    public function update(User $user, /** @scrutinizer ignore-unused */ UserRoles $userRoles)

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...
60
    {
61
        //
62
        return $this->checkPermission($user, 'Manage Permissions');
63
    }
64
65
    /**
66
     * Determine whether the user can delete the model.
67
     *
68
     * @param  \App\Models\User  $user
69
     * @param  \App\Models\UserRoles  $userRoles
70
     * @return \Illuminate\Auth\Access\Response|bool
71
     */
72
    public function delete(User $user, UserRoles $userRoles)
0 ignored issues
show
Unused Code introduced by
The parameter $userRoles 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

72
    public function delete(User $user, /** @scrutinizer ignore-unused */ UserRoles $userRoles)

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...
73
    {
74
        //
75
        return $this->checkPermission($user, 'Manage Permissions');
76
    }
77
78
    /**
79
     * Determine whether the user can restore the model.
80
     *
81
     * @param  \App\Models\User  $user
82
     * @param  \App\Models\UserRoles  $userRoles
83
     * @return \Illuminate\Auth\Access\Response|bool
84
     */
85
    public function restore(User $user, UserRoles $userRoles)
0 ignored issues
show
Unused Code introduced by
The parameter $userRoles 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

85
    public function restore(User $user, /** @scrutinizer ignore-unused */ UserRoles $userRoles)

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...
86
    {
87
        //
88
        return $this->checkPermission($user, 'Manage Permissions');
89
    }
90
91
    /**
92
     * Determine whether the user can permanently delete the model.
93
     *
94
     * @param  \App\Models\User  $user
95
     * @param  \App\Models\UserRoles  $userRoles
96
     * @return \Illuminate\Auth\Access\Response|bool
97
     */
98
    public function forceDelete(User $user, UserRoles $userRoles)
0 ignored issues
show
Unused Code introduced by
The parameter $userRoles 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

98
    public function forceDelete(User $user, /** @scrutinizer ignore-unused */ UserRoles $userRoles)

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...
99
    {
100
        //
101
        return $this->checkPermission($user, 'Manage Permissions');
102
    }
103
}
104