Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API: List users by capability or level for author selection #2157

Closed
aduth opened this issue Aug 2, 2017 · 1 comment · Fixed by #2525
Closed

REST API: List users by capability or level for author selection #2157

aduth opened this issue Aug 2, 2017 · 1 comment · Fixed by #2525
Assignees
Labels
Core REST API Task Task for Core REST API efforts

Comments

@aduth
Copy link
Member

aduth commented Aug 2, 2017

Related: #2100 (specifically #2100 (comment))

The author selection should not present options for users without the edit_posts capability. In default installations, this means excluding the Subscriber role. The users listing endpoint currently supports filtering by role. However, we ought not to hard-code default roles since plugins or themes can add their own custom roles. Therefore, we should seek to enhance the user listing endpoint with one of a few options:

  • Support filtering by capability
  • Support filtering by authors type
  • Support filtering by user_level
    • authors is equivalent to user_level != 0

The latter two mimic the behavior of the wp_dropdown_users function used in the current editor to display user options. The who values is an undocumented parameter supported by the WP_User_Query class which filters by user_level != 0.

References:

@aduth aduth added the Core REST API Task Task for Core REST API efforts label Aug 2, 2017
@aduth
Copy link
Member Author

aduth commented Aug 24, 2017

Noting that while not ideal, it is possible to filter this information client-side: When requesting with ?context=edit query parameter, each user entry in the response will include a capabilities object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core REST API Task Task for Core REST API efforts
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant