From 60a3676581a9d6cd41cd3e3a15190160410af2c1 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 19 Aug 2017 13:29:03 +0000 Subject: [PATCH] Media: bring the capability check in `wp_ajax_crop_image()` inline with those in `wp_ajax_imgedit_preview()` and `wp_ajax_image_editor()`. This change means that a user can crop an image if they have the ability to edit its attachment post, without requiring the ability to access the Customizer. Fixes #40193 git-svn-id: https://develop.svn.wordpress.org/trunk@41270 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/ajax-actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 33276d26fa..86f12e1a38 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -3219,7 +3219,7 @@ function wp_ajax_crop_image() { $attachment_id = absint( $_POST['id'] ); check_ajax_referer( 'image_editor-' . $attachment_id, 'nonce' ); - if ( ! current_user_can( 'customize' ) ) { + if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { wp_send_json_error(); }