| @@ 43-54 (lines=12) @@ | ||
| 40 | { |
|
| 41 | $service->get( |
|
| 42 | '/log', |
|
| 43 | function (array $serverData, array $getData, array $postData, array $hookData) { |
|
| 44 | Utils::requireUser($hookData, ['admin']); |
|
| 45 | ||
| 46 | $dateTime = Utils::requireParameter($getData, 'date_time'); |
|
| 47 | InputValidation::dateTime($dateTime); |
|
| 48 | $dateTimeUnix = strtotime($dateTime); |
|
| 49 | ||
| 50 | $ipAddress = Utils::requireParameter($getData, 'ip_address'); |
|
| 51 | InputValidation::ipAddress($ipAddress); |
|
| 52 | ||
| 53 | return new ApiResponse('log', $this->get($dateTimeUnix, $ipAddress)); |
|
| 54 | } |
|
| 55 | ); |
|
| 56 | ||
| 57 | $service->get( |
|
| @@ 102-110 (lines=9) @@ | ||
| 99 | ||
| 100 | $service->post( |
|
| 101 | '/users/set_otp_secret', |
|
| 102 | function (array $serverData, array $getData, array $postData, array $hookData) { |
|
| 103 | Utils::requireUser($hookData, ['portal']); |
|
| 104 | $userId = Utils::requireParameter($postData, 'user_id'); |
|
| 105 | InputValidation::userId($userId); |
|
| 106 | $otpSecret = Utils::requireParameter($postData, 'otp_secret'); |
|
| 107 | InputValidation::otpSecret($otpSecret); |
|
| 108 | ||
| 109 | return new ApiResponse('ok', $this->users->setOtpSecret($userId, $otpSecret)); |
|
| 110 | } |
|
| 111 | ); |
|
| 112 | ||
| 113 | $service->post( |
|
| @@ 138-146 (lines=9) @@ | ||
| 135 | ||
| 136 | $service->post( |
|
| 137 | '/users/set_vook_token', |
|
| 138 | function (array $serverData, array $getData, array $postData, array $hookData) { |
|
| 139 | Utils::requireUser($hookData, ['admin']); |
|
| 140 | $userId = Utils::requireParameter($postData, 'user_id'); |
|
| 141 | InputValidation::userId($userId); |
|
| 142 | $vootToken = Utils::requireParameter($postData, 'voot_token'); |
|
| 143 | InputValidation::vootToken($vootToken); |
|
| 144 | ||
| 145 | return new ApiResponse('ok', $this->users->setVootToken($userId, $vootToken)); |
|
| 146 | } |
|
| 147 | ); |
|
| 148 | } |
|
| 149 | } |
|