-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post Editor: Avoid 403 errors for users with low permissions #42413
Conversation
Size Change: +4.22 kB (0%) Total Size: 1.26 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. In testing it prevents the 403 errors 👍
packages/editor/src/components/provider/use-block-editor-settings.js
Outdated
Show resolved
Hide resolved
Thanks for the review, @talldan! |
I would love to see #48885 find it's way into core. This too would solve this issue. |
@spacedmonkey, that would be a significant improvement. |
@Mamaduka Do feel free to test my PR. WordPress/wordpress-develop#2985 |
These errors were avoided in #42413
This is a path for following changes in the Gutenberg plugin: * [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions] * [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions]. Follow-up to [43815], [44172], [46110], [51962], [52995]. Props Mamaduka, bernhard-reiter, TimothyBlynJacobs. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54084 602fd350-edb4-49c9-b593-d223f7449a82
This is a path for following changes in the Gutenberg plugin: * [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions] * [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions]. Follow-up to [43815], [44172], [46110], [51962], [52995]. Props Mamaduka, bernhard-reiter, TimothyBlynJacobs. See #56467. Built from https://develop.svn.wordpress.org/trunk@54084 git-svn-id: http://core.svn.wordpress.org/trunk@53643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is a path for following changes in the Gutenberg plugin: * [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions] * [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions]. Follow-up to [43815], [44172], [46110], [51962], [52995]. Props Mamaduka, bernhard-reiter, TimothyBlynJacobs. See #56467. Built from https://develop.svn.wordpress.org/trunk@54084 git-svn-id: https://core.svn.wordpress.org/trunk@53643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is a path for following changes in the Gutenberg plugin: * [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions] * [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions]. Follow-up to [43815], [44172], [46110], [51962], [52995]. Props Mamaduka, bernhard-reiter, TimothyBlynJacobs. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54084 602fd350-edb4-49c9-b593-d223f7449a82
This is a path for following changes in the Gutenberg plugin: * [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions] * [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions]. Follow-up to [43815], [44172], [46110], [51962], [52995]. Props Mamaduka, bernhard-reiter, TimothyBlynJacobs. See #56467. Built from https://develop.svn.wordpress.org/trunk@54084
This is a path for following changes in the Gutenberg plugin: * [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions] * [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions]. Follow-up to [43815], [44172], [46110], [51962], [52995]. Props Mamaduka, bernhard-reiter, TimothyBlynJacobs. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54084 602fd350-edb4-49c9-b593-d223f7449a82
What?
PR fixes 403 errors in the post editor for low capability users, like authors.
Similar issue #29845.
Why?
The editor should check permission before making requests when data isn't available for everyone.
How?
canEditTemplate
check before requestinggetEditedPostTemplate
. Authors can't edit templates, so there's no need for this data.canUser( 'read', 'settings' )
check inuseBlockEditorSettings
before request site settings.OPTIONS /wp/v2/settings
since the request is made in the critical path. The settings endpoint has been preloaded since Optimize preload paths for post and site editors #39256.Testing Instructions
Screenshots or screencast