| @@ 229-240 (lines=12) @@ | ||
| 226 | * |
|
| 227 | * @return null|SS_HTTPResponse |
|
| 228 | */ |
|
| 229 | protected function validateDeployment(\DNDeployment $deployment) { |
|
| 230 | if (!$deployment || !$deployment->exists()) { |
|
| 231 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 232 | } |
|
| 233 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 234 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 235 | } |
|
| 236 | if (!$deployment->canView()) { |
|
| 237 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 238 | } |
|
| 239 | return null; |
|
| 240 | } |
|
| 241 | ||
| 242 | protected function canApprove(Member $member = null) { |
|
| 243 | if (!$member) { |
|
| @@ 357-368 (lines=12) @@ | ||
| 354 | * |
|
| 355 | * @return null|SS_HTTPResponse |
|
| 356 | */ |
|
| 357 | protected function validateDeployment(\DNDeployment $deployment) { |
|
| 358 | if (!$deployment || !$deployment->exists()) { |
|
| 359 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 360 | } |
|
| 361 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 362 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 363 | } |
|
| 364 | if (!$deployment->canView()) { |
|
| 365 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 366 | } |
|
| 367 | return null; |
|
| 368 | } |
|
| 369 | ||
| 370 | } |
|
| 371 | ||