Automattic / Co-Authors-Plus

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

Issue with `Add New` button for guest authors being visible to read-only users #1001

Closed rafaucau closed 10 months ago

rafaucau commented 10 months ago

Description

I've encountered an issue with the Co Authors Plus plugin where users with read-only permissions can see the Add New button for guest authors when they possess the list_users capability. This is problematic as they don't have the required permissions to create guest authors. image After clicking the Add New button: image

Steps to Reproduce

  1. Create or edit a user role to have the list_users capability but without permissions to create or edit users and posts.
  2. Log in with a user having this role.
  3. Navigate to the guest authors list in the admin dashboard.
  4. Notice that the Add New button for guest authors is visible and clickable, even though the user should not have permissions to add new guest authors.

Expected Behavior

Users without the required permissions to create guest authors should not see the Add New button.

Actual Behavior

The Add New button for guest authors is visible and clickable for users who only have the list_users capability.

Possible Solution

Check for the appropriate capabilities before rendering the Add New button in the guest authors list.

Additional Context

This can cause confusion as users may think they have permissions to add new guest authors when they actually don't.

GaryJones commented 10 months ago

Looking in the code where this button is added, right before it is a // @todo caps check for creating a new user.

I need to nail down exactly what caps there are for listing the Guest Author page, accessing the Add New page, and successfully submitting a submission from that page, but it shouldn't be difficult to make the Add New button conditionally show - thanks for reporting!

GaryJones commented 10 months ago

Background: