| @@ 108-124 (lines=17) @@ | ||
| 105 | ||
| 106 | $service->post( |
|
| 107 | '/ccd/disable', |
|
| 108 | function (Request $request) { |
|
| 109 | $commonName = InputValidation::commonName( |
|
| 110 | $request->getPostParameter('common_name'), |
|
| 111 | true // REQUIRED |
|
| 112 | ); |
|
| 113 | ||
| 114 | $this->logger->info('disabling cn', array('cn' => $commonName)); |
|
| 115 | ||
| 116 | $response = new JsonResponse(); |
|
| 117 | $response->setBody( |
|
| 118 | array( |
|
| 119 | 'ok' => $this->staticConfig->disableCommonName($commonName), |
|
| 120 | ) |
|
| 121 | ); |
|
| 122 | ||
| 123 | return $response; |
|
| 124 | } |
|
| 125 | ); |
|
| 126 | ||
| 127 | $service->delete( |
|
| @@ 129-145 (lines=17) @@ | ||
| 126 | ||
| 127 | $service->delete( |
|
| 128 | '/ccd/disable', |
|
| 129 | function (Request $request) { |
|
| 130 | $commonName = InputValidation::commonName( |
|
| 131 | $request->getUrl()->getQueryParameter('common_name'), |
|
| 132 | true // REQUIRED |
|
| 133 | ); |
|
| 134 | ||
| 135 | $this->logger->info('enabling cn', array('cn' => $commonName)); |
|
| 136 | ||
| 137 | $response = new JsonResponse(); |
|
| 138 | $response->setBody( |
|
| 139 | array( |
|
| 140 | 'ok' => $this->staticConfig->enableCommonName($commonName), |
|
| 141 | ) |
|
| 142 | ); |
|
| 143 | ||
| 144 | return $response; |
|
| 145 | } |
|
| 146 | ); |
|
| 147 | ||
| 148 | $service->get( |
|
| @@ 150-167 (lines=18) @@ | ||
| 147 | ||
| 148 | $service->get( |
|
| 149 | '/ccd/disable', |
|
| 150 | function (Request $request) { |
|
| 151 | // we typically deal with CNs, not user IDs, but the part of |
|
| 152 | // the CN before the first '_' is considered the user ID |
|
| 153 | $userId = InputValidation::userId( |
|
| 154 | $request->getUrl()->getQueryParameter('user_id'), |
|
| 155 | false // OPTIONAL |
|
| 156 | ); |
|
| 157 | ||
| 158 | $response = new JsonResponse(); |
|
| 159 | $response->setBody( |
|
| 160 | array( |
|
| 161 | 'ok' => true, |
|
| 162 | 'disabled' => $this->staticConfig->getDisabledCommonNames($userId), |
|
| 163 | ) |
|
| 164 | ); |
|
| 165 | ||
| 166 | return $response; |
|
| 167 | } |
|
| 168 | ); |
|
| 169 | } |
|
| 170 | } |
|
| @@ 74-86 (lines=13) @@ | ||
| 71 | ||
| 72 | $service->post( |
|
| 73 | '/kill', |
|
| 74 | function (Request $request) { |
|
| 75 | $commonName = InputValidation::commonName( |
|
| 76 | $request->getPostParameter('common_name'), |
|
| 77 | true // REQUIRED |
|
| 78 | ); |
|
| 79 | ||
| 80 | $this->logger->info('killing cn', array('cn' => $commonName)); |
|
| 81 | ||
| 82 | $response = new JsonResponse(); |
|
| 83 | $response->setBody($this->serverManager->kill($commonName)); |
|
| 84 | ||
| 85 | return $response; |
|
| 86 | } |
|
| 87 | ); |
|
| 88 | } |
|
| 89 | } |
|