Add roles to root entity#71020
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Thanks for contributing, @heavyweight! Based on my experience, it might be better to propose exposing user roles via the REST API on Trac, where this component is developed and maintained. The block editor usually adds shims for REST API data that it needs, but since there's no actual use case for the user roles, it's hard to justify merging this proposal. Extenders can create their endpoints or modify existing ones and use the |
Thanks for taking the time to review. |
|
Creating a ticket on Trac will be a good start. That's also part of the backport process for similar PHP changes. See: https://github.com/WordPress/gutenberg/blob/trunk/backport-changelog/readme.md.
The |
|
Yeah I agree with @Mamaduka. This isn't appropriate for the index. I'd model this as a standalone controller that also includes the list of capabilities assigned to the role. And yeah, unless this is powering a Gutenberg feature, and the controller would need iterating, this should be made as a PR in Core. |
|
Thanks for the confirmation, @TimothyBJacobs! @heavyweight, please raise a ticket on Trac for this feature request. I'm going to close this as "won't fix" for now. |
What?
Closes
The PR adds the available roles to the response of the root entity for users with list_users permission.
Why?
Roles can be added dynamically by plugins, and there is no reliable way to fetch the available roles on the frontend.
How?
Use
rest_indexto add the roles array in the format { id, name }Testing Instructions
npm run devwp.data.select(wp.coreData.store).getEntityRecord( 'root', '__unstableBase' )in the consoleTesting Instructions for Keyboard
Screenshots or screencast