| @@ 51-58 (lines=8) @@ | ||
| 48 | ||
| 49 | $service->post( |
|
| 50 | '/openvpn/kill', |
|
| 51 | function (Request $request, TokenInfo $tokenInfo) { |
|
| 52 | $tokenInfo->getScope()->requireScope(['admin', 'portal']); |
|
| 53 | ||
| 54 | $commonName = $request->getPostParameter('common_name'); |
|
| 55 | InputValidation::commonName($commonName); |
|
| 56 | ||
| 57 | return new ApiResponse('ok', $this->serverManager->kill($commonName)); |
|
| 58 | } |
|
| 59 | ); |
|
| 60 | } |
|
| 61 | } |
|
| @@ 107-114 (lines=8) @@ | ||
| 104 | ||
| 105 | $service->get( |
|
| 106 | '/users/otp_secrets/:userId', |
|
| 107 | function ($userId, Request $request, TokenInfo $tokenInfo) { |
|
| 108 | $tokenInfo->getScope()->requireScope(['admin', 'portal']); |
|
| 109 | InputValidation::userId($userId); |
|
| 110 | ||
| 111 | $hasOtpSecret = false !== $this->otpSecret->getOtpSecret($userId); |
|
| 112 | ||
| 113 | return new ApiResponse('otp_secret', $hasOtpSecret); |
|
| 114 | } |
|
| 115 | ); |
|
| 116 | ||
| 117 | $service->post( |
|
| @@ 119-126 (lines=8) @@ | ||
| 116 | ||
| 117 | $service->post( |
|
| 118 | '/users/otp_secrets/:userId', |
|
| 119 | function ($userId, Request $request, TokenInfo $tokenInfo) { |
|
| 120 | $tokenInfo->getScope()->requireScope(['portal']); |
|
| 121 | InputValidation::userId($userId); |
|
| 122 | $otpSecret = $request->getPostParameter('otp_secret'); |
|
| 123 | InputValidation::otpSecret($otpSecret); |
|
| 124 | ||
| 125 | return new ApiResponse('ok', $this->otpSecret->setOtpSecret($userId, $otpSecret)); |
|
| 126 | } |
|
| 127 | ); |
|
| 128 | ||
| 129 | $service->delete( |
|