Skip to content

Commit 326b361

Browse files
authored
Merge pull request #63165 from nextcloud/fix/ldap-empty-config-id
fix(user_ldap): restore OCS API functionality for configID = ''
2 parents 9d164fb + 857fe04 commit 326b361

3 files changed

Lines changed: 35 additions & 15 deletions

File tree

apps/user_ldap/lib/Controller/ConfigAPIController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function create() {
7272
* 200: Config deleted successfully
7373
*/
7474
#[AuthorizedAdminSetting(settings: Admin::class)]
75-
#[ApiRoute(verb: 'DELETE', url: '/api/v1/config/{configID}')]
75+
#[ApiRoute(verb: 'DELETE', url: '/api/v1/config/{configID}', requirements: ['configID' => '.*'], defaults: ['configID' => ''])]
7676
public function delete($configID) {
7777
try {
7878
$this->ensureConfigIDExists($configID);
@@ -102,7 +102,7 @@ public function delete($configID) {
102102
* 200: Config returned
103103
*/
104104
#[AuthorizedAdminSetting(settings: Admin::class)]
105-
#[ApiRoute(verb: 'PUT', url: '/api/v1/config/{configID}')]
105+
#[ApiRoute(verb: 'PUT', url: '/api/v1/config/{configID}', requirements: ['configID' => '.*'], defaults: ['configID' => ''])]
106106
public function modify($configID, $configData) {
107107
try {
108108
$this->ensureConfigIDExists($configID);
@@ -207,7 +207,7 @@ public function modify($configID, $configData) {
207207
* 200: Config returned
208208
*/
209209
#[AuthorizedAdminSetting(settings: Admin::class)]
210-
#[ApiRoute(verb: 'GET', url: '/api/v1/config/{configID}')]
210+
#[ApiRoute(verb: 'GET', url: '/api/v1/config/{configID}', requirements: ['configID' => '.*'], defaults: ['configID' => ''])]
211211
public function show($configID, $showPassword = false) {
212212
try {
213213
$this->ensureConfigIDExists($configID);
@@ -244,7 +244,7 @@ public function show($configID, $showPassword = false) {
244244
* 200: Test was run and results are returned
245245
*/
246246
#[AuthorizedAdminSetting(settings: Admin::class)]
247-
#[ApiRoute(verb: 'POST', url: '/api/v1/config/{configID}/test')]
247+
#[ApiRoute(verb: 'POST', url: '/api/v1/config/{configID}/test', requirements: ['configID' => '.*'], defaults: ['configID' => ''])]
248248
public function testConfiguration(string $configID) {
249249
try {
250250
$this->ensureConfigIDExists($configID);
@@ -312,7 +312,7 @@ public function testConfiguration(string $configID) {
312312
* 200: Config was copied, new configID was returned
313313
*/
314314
#[AuthorizedAdminSetting(settings: Admin::class)]
315-
#[ApiRoute(verb: 'POST', url: '/api/v1/config/{configID}/copy')]
315+
#[ApiRoute(verb: 'POST', url: '/api/v1/config/{configID}/copy', requirements: ['configID' => '.*'], defaults: ['configID' => ''])]
316316
public function copyConfiguration(string $configID) {
317317
try {
318318
$this->ensureConfigIDExists($configID);

apps/user_ldap/openapi.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@
196196
"description": "ID of the config",
197197
"required": true,
198198
"schema": {
199-
"type": "string"
199+
"type": "string",
200+
"pattern": "^.*$",
201+
"default": ""
200202
}
201203
},
202204
{
@@ -369,7 +371,9 @@
369371
"description": "ID of the config",
370372
"required": true,
371373
"schema": {
372-
"type": "string"
374+
"type": "string",
375+
"pattern": "^.*$",
376+
"default": ""
373377
}
374378
},
375379
{
@@ -553,7 +557,9 @@
553557
"description": "ID of the config",
554558
"required": true,
555559
"schema": {
556-
"type": "string"
560+
"type": "string",
561+
"pattern": "^.*$",
562+
"default": ""
557563
}
558564
},
559565
{
@@ -720,7 +726,9 @@
720726
"description": "ID of the LDAP config",
721727
"required": true,
722728
"schema": {
723-
"type": "string"
729+
"type": "string",
730+
"pattern": "^.*$",
731+
"default": ""
724732
}
725733
},
726734
{
@@ -887,7 +895,9 @@
887895
"description": "ID of the LDAP config",
888896
"required": true,
889897
"schema": {
890-
"type": "string"
898+
"type": "string",
899+
"pattern": "^.*$",
900+
"default": ""
891901
}
892902
},
893903
{

openapi.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41911,7 +41911,9 @@
4191141911
"description": "ID of the config",
4191241912
"required": true,
4191341913
"schema": {
41914-
"type": "string"
41914+
"type": "string",
41915+
"pattern": "^.*$",
41916+
"default": ""
4191541917
}
4191641918
},
4191741919
{
@@ -42084,7 +42086,9 @@
4208442086
"description": "ID of the config",
4208542087
"required": true,
4208642088
"schema": {
42087-
"type": "string"
42089+
"type": "string",
42090+
"pattern": "^.*$",
42091+
"default": ""
4208842092
}
4208942093
},
4209042094
{
@@ -42268,7 +42272,9 @@
4226842272
"description": "ID of the config",
4226942273
"required": true,
4227042274
"schema": {
42271-
"type": "string"
42275+
"type": "string",
42276+
"pattern": "^.*$",
42277+
"default": ""
4227242278
}
4227342279
},
4227442280
{
@@ -42435,7 +42441,9 @@
4243542441
"description": "ID of the LDAP config",
4243642442
"required": true,
4243742443
"schema": {
42438-
"type": "string"
42444+
"type": "string",
42445+
"pattern": "^.*$",
42446+
"default": ""
4243942447
}
4244042448
},
4244142449
{
@@ -42602,7 +42610,9 @@
4260242610
"description": "ID of the LDAP config",
4260342611
"required": true,
4260442612
"schema": {
42605-
"type": "string"
42613+
"type": "string",
42614+
"pattern": "^.*$",
42615+
"default": ""
4260642616
}
4260742617
},
4260842618
{

0 commit comments

Comments
 (0)