[wp-trac] [WordPress Trac] #41262: API REST, create_posts and edit_posts are inversed

WordPress Trac noreply at wordpress.org
Thu Jul 6 14:49:58 UTC 2017


#41262: API REST, create_posts and edit_posts are inversed
-----------------------------+-----------------------------
 Reporter:  stephanedemotte  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Role/Capability  |    Version:  4.8
 Severity:  normal           |   Keywords:
  Focuses:  rest-api         |
-----------------------------+-----------------------------
 Hi,

 I have make a fresh install, the only plugins activated is <a
 href="https://github.com/WP-API/Basic-Auth">Basic-Auth</a> because i need
 to test from another server. (this is why Rest api is made for ;)

 I have create a new role (without plugin, only code) with only 1
 capability
 Here the result with "create_posts" capability

 {{{
 object(WP_Role)#421 (2) {
   ["name"]=>
   string(10) "client_api"
   ["capabilities"]=>
   array(1) {
     ["create_posts"]=>
     bool(true)
   }
 }
 {"code":"rest_cannot_create","message":"Sorry, you are not allowed to
 create posts as this user."...}
 }}}

 the same call, with "edit_posts" capability

 {{{
 object(WP_Role)#421 (2) {
   ["name"]=>
   string(10) "client_api"
   ["capabilities"]=>
   array(1) {
     ["edit_posts"]=>
     bool(true)
   }
 }
 {"id":6,"date":"2017-07-06T14:29:22","date_gmt":"2017-07-06T14:29:22","guid":{"rendered":....}
 }}}

 As you see, the post is created with edit_posts capability...

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41262>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list