| @@ 49-56 (lines=8) @@ | ||
| 46 | ||
| 47 | $service->post( |
|
| 48 | '/common_names/disable', |
|
| 49 | function (array $serverData, array $getData, array $postData, array $hookData) { |
|
| 50 | Utils::requireUser($hookData, ['admin', 'portal']); |
|
| 51 | $commonName = Utils::requireParameter($postData, 'common_name'); |
|
| 52 | InputValidation::commonName($commonName); |
|
| 53 | $this->logger->info(sprintf('disabling common_name "%s"', $commonName)); |
|
| 54 | ||
| 55 | return new ApiResponse('ok', $this->commonNames->setDisabled($commonName)); |
|
| 56 | } |
|
| 57 | ); |
|
| 58 | ||
| 59 | $service->post( |
|
| @@ 61-68 (lines=8) @@ | ||
| 58 | ||
| 59 | $service->post( |
|
| 60 | '/common_names/enable', |
|
| 61 | function (array $serverData, array $getData, array $postData, array $hookData) { |
|
| 62 | Utils::requireUser($hookData, ['admin']); |
|
| 63 | $commonName = Utils::requireParameter($postData, 'common_name'); |
|
| 64 | InputValidation::commonName($commonName); |
|
| 65 | $this->logger->info(sprintf('enabling common_name "%s"', $commonName)); |
|
| 66 | ||
| 67 | return new ApiResponse('ok', $this->commonNames->setEnabled($commonName)); |
|
| 68 | } |
|
| 69 | ); |
|
| 70 | } |
|
| 71 | } |
|
| @@ 66-73 (lines=8) @@ | ||
| 63 | ||
| 64 | $service->post( |
|
| 65 | '/users/disable', |
|
| 66 | function (array $serverData, array $getData, array $postData, array $hookData) { |
|
| 67 | Utils::requireUser($hookData, ['admin']); |
|
| 68 | $userId = Utils::requireParameter($postData, 'user_id'); |
|
| 69 | InputValidation::userId($userId); |
|
| 70 | $this->logger->info(sprintf('disabling user "%s"', $userId)); |
|
| 71 | ||
| 72 | return new ApiResponse('ok', $this->users->setDisabled($userId)); |
|
| 73 | } |
|
| 74 | ); |
|
| 75 | ||
| 76 | $service->post( |
|
| @@ 78-85 (lines=8) @@ | ||
| 75 | ||
| 76 | $service->post( |
|
| 77 | '/users/enable', |
|
| 78 | function (array $serverData, array $getData, array $postData, array $hookData) { |
|
| 79 | Utils::requireUser($hookData, ['admin']); |
|
| 80 | $userId = Utils::requireParameter($postData, 'user_id'); |
|
| 81 | InputValidation::userId($userId); |
|
| 82 | $this->logger->info(sprintf('enabling user "%s"', $userId)); |
|
| 83 | ||
| 84 | return new ApiResponse('ok', $this->users->setEnabled($userId)); |
|
| 85 | } |
|
| 86 | ); |
|
| 87 | ||
| 88 | // OTP_SECRETS |
|