[wp-trac] [WordPress Trac] #36376: current_user_can/has_cap fails when user has multiple roles

WordPress Trac noreply at wordpress.org
Mon May 9 09:47:55 UTC 2016


#36376: current_user_can/has_cap fails when user has multiple roles
-------------------------------------------------+-------------------------
 Reporter:  mikejolley                           |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Role/Capability                      |  Review
 Severity:  normal                               |     Version:
 Keywords:  has-patch reporter-feedback has-     |  Resolution:
  unit-tests                                     |     Focuses:
-------------------------------------------------+-------------------------

Comment (by mikejolley):

 @johnbillion So I tried again via UI and it did occur. I looked into it
 further and the customer role had edit_posts false.

 Whilst different from my OP, this should still be considered a issue I
 think if the roles don't layer on top correctly since caps can be modified
 over time.

 Propose making unit test the following:

 `
 $expected_caps = array(
     'read' => true,
     'edit_posts' => false,
 );
 `

 Since the primary role is author, edit_posts should still be true if
 working (patch should resolve).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36376#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list