Opened 6 years ago
Closed 6 years ago
#45194 closed enhancement (fixed)
[Gutenberg] Preload wp/v2/media using the OPTIONS method to manage `upload_files` capability
Reported by: | imath | Owned by: | danielbachhuber |
---|---|---|---|
Milestone: | 5.0 | Priority: | normal |
Severity: | normal | Version: | 5.0 |
Component: | Editor | Keywords: | has-patch has-unit-tests fixed-5.0 |
Focuses: | rest-api | Cc: |
Description
Hi.
As @aduth explained in this 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)
Attachments (2)
Change History (10)
This ticket was mentioned in Slack in #core-restapi by danielbachhuber. View the logs.
6 years ago
#5
@
6 years ago
- Owner set to danielbachhuber
- Resolution set to fixed
- Status changed from new to closed
In 43833:
In 45194.2.diff:
block_editor_preload_paths
filter to allow plugins / themes to preload additional paths.$path
withis_array( $path ) && 2 === count( $path )
.