| @@ 280-291 (lines=12) @@ | ||
| 277 | * |
|
| 278 | * @return null|SS_HTTPResponse |
|
| 279 | */ |
|
| 280 | protected function validateDeployment(\DNDeployment $deployment) { |
|
| 281 | if (!$deployment || !$deployment->exists()) { |
|
| 282 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 283 | } |
|
| 284 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 285 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 286 | } |
|
| 287 | if (!$deployment->canView()) { |
|
| 288 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 289 | } |
|
| 290 | return null; |
|
| 291 | } |
|
| 292 | ||
| 293 | /** |
|
| 294 | * @param string $name |
|
| @@ 273-284 (lines=12) @@ | ||
| 270 | * |
|
| 271 | * @return null|SS_HTTPResponse |
|
| 272 | */ |
|
| 273 | protected function validateDeployment(\DNDeployment $deployment) { |
|
| 274 | if (!$deployment || !$deployment->exists()) { |
|
| 275 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 276 | } |
|
| 277 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 278 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 279 | } |
|
| 280 | if (!$deployment->canView()) { |
|
| 281 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 282 | } |
|
| 283 | return null; |
|
| 284 | } |
|
| 285 | ||
| 286 | } |
|
| 287 | ||