1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pratiksh\Adminetic\Policies; |
4
|
|
|
|
5
|
|
|
use App\Models\User; |
|
|
|
|
6
|
|
|
use Illuminate\Auth\Access\HandlesAuthorization; |
7
|
|
|
|
8
|
|
|
class UserPolicy |
9
|
|
|
{ |
10
|
|
|
use HandlesAuthorization; |
11
|
|
|
|
12
|
|
|
public function before($user, $ability) |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
if ($user->isSuperAdmin()) { |
15
|
|
|
return true; |
16
|
|
|
} |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Determine whether the user can view any models. |
21
|
|
|
* |
22
|
|
|
* @param \App\Models\User $user |
23
|
|
|
* @return mixed |
24
|
|
|
*/ |
25
|
|
|
public function viewAny(User $user) |
26
|
|
|
{ |
27
|
|
|
return $user->userCanDo('User', 'browse'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Determine whether the user can view the model. |
32
|
|
|
* |
33
|
|
|
* @param \App\Models\User $user |
34
|
|
|
* @param \App\Models\User $model |
35
|
|
|
* @return mixed |
36
|
|
|
*/ |
37
|
|
|
public function view(User $user, User $model) |
|
|
|
|
38
|
|
|
{ |
39
|
|
|
return $user->userCanDo('User', 'read'); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Determine whether the user can create models. |
44
|
|
|
* |
45
|
|
|
* @param \App\Models\User $user |
46
|
|
|
* @return mixed |
47
|
|
|
*/ |
48
|
|
|
public function create(User $user) |
49
|
|
|
{ |
50
|
|
|
return $user->userCanDo('User', 'add'); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Determine whether the user can update the model. |
55
|
|
|
* |
56
|
|
|
* @param \App\Models\User $user |
57
|
|
|
* @param \App\Models\User $model |
58
|
|
|
* @return mixed |
59
|
|
|
*/ |
60
|
|
|
public function update(User $user, User $model) |
|
|
|
|
61
|
|
|
{ |
62
|
|
|
return $user->userCanDo('User', 'edit'); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Determine whether the user can delete the model. |
67
|
|
|
* |
68
|
|
|
* @param \App\Models\User $user |
69
|
|
|
* @param \App\Models\User $model |
70
|
|
|
* @return mixed |
71
|
|
|
*/ |
72
|
|
|
public function delete(User $user, User $model) |
|
|
|
|
73
|
|
|
{ |
74
|
|
|
return $user->userCanDo('User', 'delete'); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Determine whether the user can restore the model. |
79
|
|
|
* |
80
|
|
|
* @param \App\Models\User $user |
81
|
|
|
* @param \App\Models\User $model |
82
|
|
|
* @return mixed |
83
|
|
|
*/ |
84
|
|
|
public function restore(User $user, User $model) |
|
|
|
|
85
|
|
|
{ |
86
|
|
|
return true; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Determine whether the user can permanently delete the model. |
91
|
|
|
* |
92
|
|
|
* @param \App\Models\User $user |
93
|
|
|
* @param \App\Models\User $model |
94
|
|
|
* @return mixed |
95
|
|
|
*/ |
96
|
|
|
public function forceDelete(User $user, User $model) |
|
|
|
|
97
|
|
|
{ |
98
|
|
|
return true; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths