| @@ 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 | /** |
|
| 243 | * @return ArrayList |
|
| @@ 252-263 (lines=12) @@ | ||
| 249 | * |
|
| 250 | * @return null|SS_HTTPResponse |
|
| 251 | */ |
|
| 252 | protected function validateDeployment(\DNDeployment $deployment) { |
|
| 253 | if (!$deployment || !$deployment->exists()) { |
|
| 254 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 255 | } |
|
| 256 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 257 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 258 | } |
|
| 259 | if (!$deployment->canView()) { |
|
| 260 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 261 | } |
|
| 262 | return null; |
|
| 263 | } |
|
| 264 | ||
| 265 | } |
|
| 266 | ||