Proof-of-concept: allow partial permissions for FSE theme templates #27632
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Some ideas to close #27597. Also may resolve #29079.
This should not break anything, but would enable users to have partial permissions to edit FSE theme templates, for example,
edit_single_templates
ordelete_others_archive_templates
etc.One "limitation" of this implementation is that some UI features are protected behind general capabilities like
edit_templates
andpublish_templates
and are not visible unless those general capabilities are granted. This would be best fixed with patches to core.Another limitation is there needs to be a way to stop users from losing edit access by changing the slug of their template to something that they can't edit. There is some code to deal with this, but it may not work correctly.
This is intended as a proof of concept and a discussion starter rather than final code to be merged.
How has this been tested?
One way to test this implementation is to give a user the capabilities
edit_templates
anddelete_single_templates
. Then observe that if they create asingle
template, they can delete it, but if they create anarchive
template, they can not delete it.Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: