Skip to content

Allow JSON booleans to be sent for "confirm" when creating users.

When doing a POST to /api/v3/users, the "confirm" parameter will not accept a JSON boolean value of "false". This request correctly sets "confirm" to false:

{"provider":"ldapmain",
 "email":"ryan+ryantest@myemail.com",
 "confirm":"false",
 "password":"dummypassword",
 "name":"Ryan OlsonTest",
 "username":"ryantest",
 "extern_uid":"uid=ryantest,cn=users,dc=mydomain,dc=com"
}

But this request treats "confirm" as true:

{"provider":"ldapmain",
 "email":"ryan+ryantest@myemail.com",
 "confirm":false,
 "password":"dummypassword",
 "name":"Ryan OlsonTest",
 "username":"ryantest",
 "extern_uid":"uid=ryantest,cn=users,dc=mydomain,dc=com"
}

The test I added doesn't actually exercise the bug since the rspec tests are using "attributes_for" which seems to send the content URL encoded rather than via JSON. (If I'm seeing that right.)

The handling of this parameter doesn't seem to match how other boolean parameters are handled elsewhere in the API, maybe the string matching of the parameter should be centralized or eliminated instead? Or should the documentation specify that JSON booleans should be avoided?

Merge request reports