[wp-trac] [WordPress Trac] #45194: [Gutenberg] Preload wp/v2/media using the OPTIONS method to manage `upload_files` capability
WordPress Trac
noreply at wordpress.org
Fri Oct 26 00:29:57 UTC 2018
#45194: [Gutenberg] Preload wp/v2/media using the OPTIONS method to manage
`upload_files` capability
--------------------------+-----------------------------
Reporter: imath | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 5.0
Severity: normal | Keywords: has-patch
Focuses: rest-api |
--------------------------+-----------------------------
Hi.
As @aduth explained in this
[https://github.com/WordPress/gutenberg/pull/4155#issuecomment-432272009
PR], it will be needed to update preloaded paths so that they include the
`wp/v2/media` endpoint (using the OPTIONS method). This way of checking
the `upload_files` caps using the Allow header of the result of the
endpoint request has been advised by @danielbachhuber.
The Media blocks UI/Featured image section of the document sidebar when
the user has the contributor role should be improved.
As this role cannot `upload_files` the Upload / Drag and drop controls &
the Media Library shouldn't be available.
The attached patch makes sure it's possible to preload this specific path
using the OPTIONS method without editing the other paths (eg: grouping
them into a GET array attribute)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45194>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list