1 | <?php |
||
20 | class IssuePolicy |
||
21 | { |
||
22 | use HandlesAuthorization, ProjectAccess; |
||
23 | |||
24 | /** |
||
25 | * @param User $user |
||
26 | * @param string $ability |
||
27 | * |
||
28 | * @return bool |
||
29 | */ |
||
30 | public function before(User $user, $ability) |
||
36 | |||
37 | /** |
||
38 | * Determine whether the user can view the issue. |
||
39 | * |
||
40 | * @param User $user |
||
41 | * @param Issue $issue |
||
42 | * @param Project $project |
||
43 | * |
||
44 | * @return bool |
||
45 | */ |
||
46 | public function view(User $user, Issue $issue, Project $project) |
||
56 | |||
57 | /** |
||
58 | * @param User $user |
||
59 | * @param Issue $issue |
||
60 | * @param Project $project |
||
61 | * |
||
62 | * @return bool |
||
63 | */ |
||
64 | protected function notIssueCreatorAndInternalProject(User $user, Issue $issue, Project $project) |
||
68 | |||
69 | /** |
||
70 | * Determine whether the user can create issues. |
||
71 | * |
||
72 | * @param User $user |
||
73 | * @param Project $project |
||
74 | * |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function create(User $user, Project $project) |
||
81 | |||
82 | /** |
||
83 | * Determine whether the user can update the issue. |
||
84 | * |
||
85 | * @param User $user |
||
86 | * @param Issue $issue |
||
87 | * @param Project|null $project |
||
88 | * |
||
89 | * @return bool |
||
90 | */ |
||
91 | public function update(User $user, Issue $issue, Project $project = null) |
||
106 | |||
107 | /** |
||
108 | * Determine whether the user can delete the issue. |
||
109 | * |
||
110 | * @param User $user |
||
111 | * @param Issue $issue |
||
112 | * |
||
113 | * @return bool |
||
114 | */ |
||
115 | public function delete(User $user, Issue $issue) |
||
119 | |||
120 | /** |
||
121 | * Can lock quote issue. |
||
122 | * |
||
123 | * @param User $user |
||
124 | * @param Issue $issue |
||
125 | * @param Project|null $project |
||
126 | * |
||
127 | * @return bool |
||
128 | */ |
||
129 | public function lockQuote(User $user, Issue $issue, Project $project = null) |
||
133 | |||
134 | /** |
||
135 | * Check if a user is allowed to see the issue quote. |
||
136 | * |
||
137 | * @param User $user |
||
138 | * @param Issue $issue |
||
139 | * |
||
140 | * @return bool |
||
141 | */ |
||
142 | public function viewLockedQuote(User $user, Issue $issue) |
||
151 | } |
||
152 |