[wp-trac] [WordPress Trac] #44287: REST API: Declare user capability to perform actions using JSON Hyper Schema `targetSchema`

WordPress Trac noreply at wordpress.org
Wed Jul 11 09:20:14 UTC 2018


#44287: REST API: Declare user capability to perform actions using JSON Hyper
Schema `targetSchema`
-------------------------------------------------+-------------------------
 Reporter:  danielbachhuber                      |       Owner:  pento
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  4.9.8
Component:  Role/Capability                      |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit      |     Focuses:  rest-api
  fixed-major                                    |
-------------------------------------------------+-------------------------
Changes (by pento):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"43438" 43438]:
 {{{
 #!CommitTicketReference repository="" revision="43438"
 REST API: Declare user capabilities using JSON Hyper Schema's
 "targetSchema".

 There are a variety of operations a WordPress user can only perform if
 they have the correct capabilities. A REST API client should only display
 UI for one of these operations if the WordPress user can perform the
 operation.

 Rather than requiring REST API clients to calculate whether to display UI
 based on potentially complicated combinations of user capabilities,
 `targetSchema` allows us to expose a single flag to show whether the
 corresponding UI should be displayed.

 This change also includes flags on post objects for the following actions:

 - `action-publish`: The current user can publish this post.
 - `action-sticky`: The current user can make this post sticky, and the
 post type supports sticking.
 - `action-assign-author': The current user can change the author on this
 post.
 - `action-assign-{$taxonomy}`: The current user can assign terms from the
 "$taxonomy" taxonomy to this post.
 - `action-create-{$taxonomy}`: The current user can create terms int the
 "$taxonomy" taxonomy.

 Merges [43437] to the 4.9 branch.

 Props TimothyBlynJacobs, danielbachhuber.
 Fixes #44287.
 }}}

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


More information about the wp-trac mailing list