[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 06:22:12 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
---------------------------------------------+-----------------------
Changes (by pento):

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


Comment:

 In [changeset:"43437" 43437]:
 {{{
 #!CommitTicketReference repository="" revision="43437"
 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.

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

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


More information about the wp-trac mailing list