ImportPolicy::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
eloc 0
nc 1
nop 2
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\Access\User\User;
6
use App\Models\Import;
7
use App\Models\Project;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class ImportPolicy
11
{
12
    use HandlesAuthorization;
13
14
    public function before($user)
15
    {
16
        if ($user->is_administrator) {
17
            return true;
18
        }
19
    }
20
21
    /**
22
     * Determine whether the user can view the import.
23
     *
24
     * @param  User  $user
25
     * @param  \App\Models\Import  $import
26
     * @return mixed
27
     */
28
    public function view(User $user, Import $import)
29
    {
30
        return true;
31
    }
32
33
    /**
34
     * Determine whether the user can update the project.
35
     *
36
     * @param  User    $user
37
     * @param  Project $project
38
     *
39
     * @return mixed
40
     */
41
    public function importProject(User $user, Project $project)
42
    {
43
        return (bool) $user->isAdminForProjectId($project->id);
44
    }
45
46
    /**
47
     * Determine whether the user can create imports.
48
     *
49
     * @param  User  $user
50
     * @return mixed
51
     */
52
    public function create(User $user, Project $project)
53
    {
54
        return (bool) $user->isAdminForProjectId($project->id);
55
    }
56
57
    /**
58
     * Determine whether the user can update the import.
59
     *
60
     * @param  User  $user
61
     * @param  \App\Models\Import  $import
62
     * @return mixed
63
     */
64
    public function update(User $user, Import $import)
65
    {
66
        //
67
    }
68
69
    /**
70
     * Determine whether the user can delete the import.
71
     *
72
     * @param  User  $user
73
     * @param  \App\Models\Import  $import
74
     * @return mixed
75
     */
76
    public function delete(User $user, Import $import)
77
    {
78
        //
79
    }
80
}
81