| @@ 288-299 (lines=12) @@ | ||
| 285 | * |
|
| 286 | * @return null|SS_HTTPResponse |
|
| 287 | */ |
|
| 288 | protected function validateDeployment($deployment) { |
|
| 289 | if (!$deployment || !$deployment->exists()) { |
|
| 290 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 291 | } |
|
| 292 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 293 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 294 | } |
|
| 295 | if (!$deployment->canView()) { |
|
| 296 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 297 | } |
|
| 298 | return null; |
|
| 299 | } |
|
| 300 | ||
| 301 | /** |
|
| 302 | * @param string $name |
|
| @@ 290-301 (lines=12) @@ | ||
| 287 | * |
|
| 288 | * @return null|SS_HTTPResponse |
|
| 289 | */ |
|
| 290 | protected function validateDeployment($deployment) { |
|
| 291 | if (!$deployment || !$deployment->exists()) { |
|
| 292 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 293 | } |
|
| 294 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 295 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 296 | } |
|
| 297 | if (!$deployment->canView()) { |
|
| 298 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 299 | } |
|
| 300 | return null; |
|
| 301 | } |
|
| 302 | ||
| 303 | } |
|
| 304 | ||