[wp-trac] [WordPress Trac] #14122: Custom "capabilities" appears broken on custom post types

WordPress Trac wp-trac at lists.automattic.com
Fri Nov 5 21:17:46 UTC 2010


#14122: Custom "capabilities" appears broken on custom post types
----------------------------+-----------------------------------------------
 Reporter:  jakemgold       |       Owner:  nacin      
     Type:  task (blessed)  |      Status:  assigned   
 Priority:  normal          |   Milestone:  3.1        
Component:  Post Types      |     Version:  3.0        
 Severity:  normal          |    Keywords:  needs-patch
----------------------------+-----------------------------------------------
Changes (by nacin):

  * keywords:  has-patch => needs-patch


Comment:

 So here's what I've been able to track down. My code was based on a false
 assumption.

 Let's say you have a thing post type: capability_type = post (default),
 capabilities = array( edit_things, edit_thing, etc. )

 The problem is that capability_type acts not only as a base, or as a
 switch for map_meta_cap, but also as a faulty switch in map_meta_cap. The
 end result is that if you want to edit_thing 4, you end up with also
 needing edit_published_posts etc. This only occurs when capability_type =
 post, of course. Even 'page' will not trigger this kind of handling.

 To me, it's faulty meta capability handling, so I'm calling this a bug,
 and I intend to change functionality so edit_published_posts will not be
 required for editing thing 4, regardless of capability_type.

 The solution (which I'll work on) is to re-work the code in map_meta_cap
 to not map when map_meta_cap is false, end of discussion.

 Does anyone see an issue with this? Alternative would be WraithKenny's
 patch, but keep in mind it would then notice out when capability_type =
 post and a custom capabilities array is set, so it's not enough.

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


More information about the wp-trac mailing list