| @@ 291-302 (lines=12) @@ | ||
| 288 | * |
|
| 289 | * @return null|SS_HTTPResponse |
|
| 290 | */ |
|
| 291 | protected function validateDeployment($deployment) { |
|
| 292 | if (!$deployment || !$deployment->exists()) { |
|
| 293 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 294 | } |
|
| 295 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 296 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 297 | } |
|
| 298 | if (!$deployment->canView()) { |
|
| 299 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 300 | } |
|
| 301 | return null; |
|
| 302 | } |
|
| 303 | ||
| 304 | /** |
|
| 305 | * @param string $name |
|
| @@ 417-428 (lines=12) @@ | ||
| 414 | * |
|
| 415 | * @return null|SS_HTTPResponse |
|
| 416 | */ |
|
| 417 | protected function validateDeployment($deployment) { |
|
| 418 | if (!$deployment || !$deployment->exists()) { |
|
| 419 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 420 | } |
|
| 421 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 422 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 423 | } |
|
| 424 | if (!$deployment->canView()) { |
|
| 425 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 426 | } |
|
| 427 | return null; |
|
| 428 | } |
|
| 429 | ||
| 430 | } |
|
| 431 | ||