| @@ 96-111 (lines=16) @@ | ||
| 93 | ||
| 94 | $this->post( |
|
| 95 | '/ccd/disable', |
|
| 96 | function (Request $request) { |
|
| 97 | $commonName = $request->getPostParameter('common_name'); |
|
| 98 | if (is_null($commonName)) { |
|
| 99 | throw new BadRequestException('missing common_name'); |
|
| 100 | } |
|
| 101 | Utils::validateCommonName($commonName); |
|
| 102 | ||
| 103 | $response = new JsonResponse(); |
|
| 104 | $response->setBody( |
|
| 105 | array( |
|
| 106 | 'ok' => $this->ccdHandler->disableCommonName($commonName), |
|
| 107 | ) |
|
| 108 | ); |
|
| 109 | ||
| 110 | return $response; |
|
| 111 | } |
|
| 112 | ); |
|
| 113 | ||
| 114 | $this->delete( |
|
| @@ 133-150 (lines=18) @@ | ||
| 130 | ||
| 131 | $this->get( |
|
| 132 | '/ccd/disable', |
|
| 133 | function (Request $request) { |
|
| 134 | // we typically deal with CNs, not user IDs, but the part of |
|
| 135 | // the CN before the first '_' is considered the user ID |
|
| 136 | $userId = $request->getUrl()->getQueryParameter('user_id'); |
|
| 137 | if (!is_null($userId)) { |
|
| 138 | Utils::validateUserId($userId); |
|
| 139 | } |
|
| 140 | ||
| 141 | $response = new JsonResponse(); |
|
| 142 | $response->setBody( |
|
| 143 | array( |
|
| 144 | 'ok' => true, |
|
| 145 | 'disabled' => $this->ccdHandler->getDisabledCommonNames($userId), |
|
| 146 | ) |
|
| 147 | ); |
|
| 148 | ||
| 149 | return $response; |
|
| 150 | } |
|
| 151 | ); |
|
| 152 | ||
| 153 | $this->post( |
|