1 | <?php |
||||
2 | |||||
3 | namespace App\Policies; |
||||
4 | |||||
5 | use App\Models\ServiceTemplate; |
||||
6 | use App\Models\User; |
||||
7 | use Illuminate\Auth\Access\HandlesAuthorization; |
||||
8 | |||||
9 | class ServiceTemplatePolicy |
||||
10 | { |
||||
11 | use HandlesAuthorization; |
||||
12 | |||||
13 | /** |
||||
14 | * Determine whether the user can view any service templates. |
||||
15 | * |
||||
16 | * @param \App\Models\User $user |
||||
17 | * @return mixed |
||||
18 | */ |
||||
19 | public function viewAny(User $user) |
||||
20 | { |
||||
21 | return $user->hasGlobalRead(); |
||||
22 | } |
||||
23 | |||||
24 | /** |
||||
25 | * Determine whether the user can view the service template. |
||||
26 | * |
||||
27 | * @param \App\Models\User $user |
||||
28 | * @param \App\Models\ServiceTemplate $template |
||||
29 | * @return mixed |
||||
30 | */ |
||||
31 | public function view(User $user, ServiceTemplate $template) |
||||
0 ignored issues
–
show
|
|||||
32 | { |
||||
33 | return $this->viewAny($user); |
||||
34 | } |
||||
35 | |||||
36 | /** |
||||
37 | * Determine whether the user can create service templates. |
||||
38 | * |
||||
39 | * @param \App\Models\User $user |
||||
40 | * @return mixed |
||||
41 | */ |
||||
42 | public function create(User $user) |
||||
43 | { |
||||
44 | return $user->hasGlobalAdmin(); |
||||
45 | } |
||||
46 | |||||
47 | /** |
||||
48 | * Determine whether the user can update the service template. |
||||
49 | * |
||||
50 | * @param \App\Models\User $user |
||||
51 | * @param \App\Models\ServiceTemplate $template |
||||
52 | * @return mixed |
||||
53 | */ |
||||
54 | public function update(User $user, ServiceTemplate $template) |
||||
0 ignored issues
–
show
The parameter
$template 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
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...
|
|||||
55 | { |
||||
56 | return $user->isAdmin(); |
||||
57 | } |
||||
58 | |||||
59 | /** |
||||
60 | * Determine whether the user can delete the service template. |
||||
61 | * |
||||
62 | * @param \App\Models\User $user |
||||
63 | * @param \App\Models\ServiceTemplate $template |
||||
64 | * @return mixed |
||||
65 | */ |
||||
66 | public function delete(User $user, ServiceTemplate $template) |
||||
0 ignored issues
–
show
The parameter
$template 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
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...
|
|||||
67 | { |
||||
68 | return $user->isAdmin(); |
||||
69 | } |
||||
70 | |||||
71 | /** |
||||
72 | * Determine whether the user can restore the service template. |
||||
73 | * |
||||
74 | * @param \App\Models\User $user |
||||
75 | * @param \App\Models\ServiceTemplate $template |
||||
76 | * @return mixed |
||||
77 | */ |
||||
78 | public function restore(User $user, ServiceTemplate $template) |
||||
0 ignored issues
–
show
The parameter
$template 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
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...
|
|||||
79 | { |
||||
80 | return $user->hasGlobalAdmin(); |
||||
81 | } |
||||
82 | |||||
83 | /** |
||||
84 | * Determine whether the user can permanently delete the service template. |
||||
85 | * |
||||
86 | * @param \App\Models\User $user |
||||
87 | * @param \App\Models\ServiceTemplate $template |
||||
88 | * @return mixed |
||||
89 | */ |
||||
90 | public function forceDelete(User $user, ServiceTemplate $template) |
||||
0 ignored issues
–
show
The parameter
$template 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
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...
|
|||||
91 | { |
||||
92 | return $user->isAdmin(); |
||||
93 | } |
||||
94 | |||||
95 | /** |
||||
96 | * Determine whether the user can view the stored configuration of the service template |
||||
97 | * from Oxidized or Rancid |
||||
98 | * |
||||
99 | * @param \App\Models\User $user |
||||
100 | * @param \App\Models\ServiceTemplate $template |
||||
101 | * @return mixed |
||||
102 | */ |
||||
103 | public function showConfig(User $user, ServiceTemplate $template) |
||||
0 ignored issues
–
show
The parameter
$template 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
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...
|
|||||
104 | { |
||||
105 | return $user->isAdmin(); |
||||
106 | } |
||||
107 | |||||
108 | /** |
||||
109 | * Determine whether the user can update service template notes. |
||||
110 | * |
||||
111 | * @param \App\Models\User $user |
||||
112 | * @param \App\Models\ServiceTemplate $template |
||||
113 | * @return mixed |
||||
114 | */ |
||||
115 | public function updateNotes(User $user, ServiceTemplate $template) |
||||
0 ignored issues
–
show
The parameter
$template 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
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...
|
|||||
116 | { |
||||
117 | return $user->isAdmin(); |
||||
118 | } |
||||
119 | } |
||||
120 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.