| @@ 304-315 (lines=12) @@ | ||
| 301 | * |
|
| 302 | * @return null|SS_HTTPResponse |
|
| 303 | */ |
|
| 304 | protected function validateDeployment($deployment) { |
|
| 305 | if (!$deployment || !$deployment->exists()) { |
|
| 306 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 307 | } |
|
| 308 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 309 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 310 | } |
|
| 311 | if (!$deployment->canView()) { |
|
| 312 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 313 | } |
|
| 314 | return null; |
|
| 315 | } |
|
| 316 | ||
| 317 | /** |
|
| 318 | * @param string $name |
|
| @@ 313-324 (lines=12) @@ | ||
| 310 | * |
|
| 311 | * @return null|SS_HTTPResponse |
|
| 312 | */ |
|
| 313 | protected function validateDeployment($deployment) { |
|
| 314 | if (!$deployment || !$deployment->exists()) { |
|
| 315 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 316 | } |
|
| 317 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 318 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 319 | } |
|
| 320 | if (!$deployment->canView()) { |
|
| 321 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 322 | } |
|
| 323 | return null; |
|
| 324 | } |
|
| 325 | ||
| 326 | } |
|
| 327 | ||