Automattic / Co-Authors-Plus

Multiple bylines and Guest Authors for WordPress
https://wordpress.org/plugins/co-authors-plus/
GNU General Public License v2.0
290 stars 205 forks source link

Show author taxonomy in REST API, hide description based on capabilities #931

Closed douglas-johnson closed 1 year ago

douglas-johnson commented 1 year ago

Description

Continues from #899 resolves #930 using the last of the proposed solutions in which the author taxonomy is made available in the WP REST API with the base coauthors but without the term description.

The privacy issue pointed out in #850 and fixed by #851 is handled based on capabilities. In a filter on rest_prepare_author, the description is changed to an empty string if the current user does not have the edit_posts capability.

My intention was to make the view context of the coauthors endpoint available to anyone who could open a post in the block editor. In that way, it could be used in custom blocks as was mentioned in #851 but would not be available to subscribers or unauthenticated users.

I am open to making revisions if security of the email addresses needs to be more strict or if a different approach is preferable for another reason.

Steps to Test

I used Application Passwords for authentication in my own testing.