You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
Fail: {"code":"rest_forbidden","message":"You don't have permission to do this.","data":{"status":403}}. It was expected that since the snapshot UUID was present, that the publish status in the snapshot would have allowed the post to be accessed.
The issue is in \WP_REST_Posts_Controller::check_read_permission(), specifically:
// Can we read the post?if ( 'publish' === $post->post_status || current_user_can( $post_type->cap->read_post, $post->ID ) ) {
returntrue;
}
It seems the fix for this is to add user_has_cap filter to explicitly grant read_post capability for a post that is modified in the snapshot to have a status whereby the requesting user would be able to view it.
The text was updated successfully, but these errors were encountered:
@valendesigns actually, there is a WP_User object that is passed into user_has_cap. It's just that they have an ID of 0. It looks like:
object(WP_User)[184]
public 'data' =>
object(stdClass)[183]
public 'ID' => int 0
public 'caps' =>
array (size=0)
empty
public 'cap_key' => null
public 'roles' =>
array (size=0)
empty
public 'allcaps' =>
array (size=0)
empty
public 'filter' => null
So the filter would just check if 0 === $user->ID for unauthenticated users.
publish
status, but do not Publish{"code":"rest_forbidden","message":"You don't have permission to do this.","data":{"status":403}}
. It was expected that since the snapshot UUID was present, that thepublish
status in the snapshot would have allowed the post to be accessed.The issue is in
\WP_REST_Posts_Controller::check_read_permission()
, specifically:It seems the fix for this is to add
user_has_cap
filter to explicitly grantread_post
capability for a post that is modified in the snapshot to have a status whereby the requesting user would be able to view it.The text was updated successfully, but these errors were encountered: