| @@ 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 | protected function canApprove(Member $member = null) { |
|
| 243 | if (!$member) { |
|
| @@ 359-370 (lines=12) @@ | ||
| 356 | * |
|
| 357 | * @return null|SS_HTTPResponse |
|
| 358 | */ |
|
| 359 | protected function validateDeployment(\DNDeployment $deployment) { |
|
| 360 | if (!$deployment || !$deployment->exists()) { |
|
| 361 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
|
| 362 | } |
|
| 363 | if ($deployment->EnvironmentID != $this->environment->ID) { |
|
| 364 | return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403); |
|
| 365 | } |
|
| 366 | if (!$deployment->canView()) { |
|
| 367 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
|
| 368 | } |
|
| 369 | return null; |
|
| 370 | } |
|
| 371 | ||
| 372 | } |
|
| 373 | ||