| @@ 113-128 (lines=16) @@ | ||
| 110 | // get configuration for a particular user_id |
|
| 111 | $service->get( |
|
| 112 | '/config/users/:userId', |
|
| 113 | function (Request $request, TokenInfo $tokenInfo, $userId) { |
|
| 114 | self::requireScope($tokenInfo, ['admin', 'portal']); |
|
| 115 | ||
| 116 | InputValidation::userId($userId); |
|
| 117 | ||
| 118 | $userConfig = $this->configStorage->getUserConfig($userId); |
|
| 119 | // we never want the OTP secret to leave the system |
|
| 120 | $userConfig->hideOtpSecret(); |
|
| 121 | ||
| 122 | $response = new JsonResponse(); |
|
| 123 | $response->setBody( |
|
| 124 | $userConfig->toArray() |
|
| 125 | ); |
|
| 126 | ||
| 127 | return $response; |
|
| 128 | } |
|
| 129 | ); |
|
| 130 | ||
| 131 | // set configuration for a particular user_id |
|
| @@ 83-95 (lines=13) @@ | ||
| 80 | ||
| 81 | $service->post( |
|
| 82 | '/openvpn/kill', |
|
| 83 | function (Request $request, TokenInfo $tokenInfo) { |
|
| 84 | self::requireScope($tokenInfo, 'openvpn_kill'); |
|
| 85 | ||
| 86 | $commonName = $request->getPostParameter('common_name'); |
|
| 87 | InputValidation::commonName($commonName); |
|
| 88 | ||
| 89 | $this->logger->info('killing cn', array('cn' => $commonName)); |
|
| 90 | ||
| 91 | $response = new JsonResponse(); |
|
| 92 | $response->setBody($this->serverManager->kill($commonName)); |
|
| 93 | ||
| 94 | return $response; |
|
| 95 | } |
|
| 96 | ); |
|
| 97 | } |
|
| 98 | ||