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

WordPress Trac noreply at wordpress.org
Mon Jun 18 12:52:04 UTC 2018


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

 * milestone:  4.9.8 => 4.9.7


Comment:

 @TimothyBlynJacobs Looks good! I see a couple small nits to be addressed:

 1. To make `get_available_actions()` more useful for subclassing, let's
 pass `$request` into it too and then perform the `'edit' ===
 $request['context']` check within `get_available_actions()`. This ensures
 `get_available_actions()` always executes, regardless of `context`
 context.
 2. We should avoid variable assignment within conditionals.

 This:

 {{{
 if ( $schema_links = $this->get_schema_links() )
 }}}

 Should become:

 {{{
 $schema_links = $this->get_schema_links();
 if ( $schema_links )
 }}}

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


More information about the wp-trac mailing list