[wp-trac] [WordPress Trac] #22415: media-upload.php should check whether current user can edit a particular post type

WordPress Trac noreply at wordpress.org
Mon Nov 12 01:03:00 UTC 2012


#22415: media-upload.php should check whether current user can edit a particular
post type
-------------------------------+------------------------------
 Reporter:  danielbachhuber    |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Role/Capability    |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |
-------------------------------+------------------------------

Comment (by danielbachhuber):

 In Co-Authors Plus, we're filtering 'user_has_cap' to give co-authors
 permission to edit a post. Here's the relevant, now functional, code:

 https://github.com/Automattic/Co-Authors-
 Plus/blob/da2844c2f7bd401c5ca9066127235ff81a63419b/co-authors-
 plus.php#L1063

 A user reported they created custom roles for editing pages and users with
 the role weren't able to upload attachments:

 https://github.com/Automattic/Co-Authors-Plus/issues/61

 The Co-Authors Plus filter kicks in based on the original cap check passed
 to current_user_can(). In this particular instance, the filter was failing
 this check:

 https://github.com/Automattic/Co-Authors-
 Plus/blob/83b8fd293bcbfe75b2ca47724c88bcf9e4d78bf1/co-authors-
 plus.php#L1091

 because `$args[0]` was 'edit_post' and `$post_type_object->cap->edit_post`
 was 'edit_page'.

 I've since found a somewhat reliable workaround, but I think the semantics
 identified are off and should be fixed.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22415#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list