[wp-trac] [WordPress Trac] #39000: REST API: Require the reassign parameter when deleting users
WordPress Trac
noreply at wordpress.org
Thu Dec 1 18:38:06 UTC 2016
#39000: REST API: Require the reassign parameter when deleting users
------------------------------------------+-----------------------
Reporter: jeremyfelt | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.7
Component: Users | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses: rest-api
------------------------------------------+-----------------------
Comment (by jeremyfelt):
Replying to [comment:2 joehoyle]:
> @jeremyfelt why the `444` status code for the response here?
Accidental leftover. :) I was using 444 to look for the test error vs
another.
> > I may be missing something, but it seems like this check in
has_valid_params() won't allow a required parameter to also be null.
>
> This sounds correct, I think we probably shouldn't use `required` here -
the whole `null` means "delete", but `null` needs to be passed is somewhat
funky. `null` is typically not a value in the rest api. Did we discuss
using `false` to mean "don't reassign the posts"? That seems like the most
logical / semantic value to indicate this to me.
Summing up the discussion in Slack a bit - We're probably okay to look for
a falsey value and not use `null`. This could be an empty string,
`'false'`, or `false`. `0` must be counted as a valid non-falsey value in
this case.
I don't have time to work on an updated patch at the moment, but I don't
think it will be too far off from where it is now.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39000#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list