Skip to content
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

Proof-of-concept: allow partial permissions for FSE theme templates #27632

Closed
wants to merge 4 commits into from

Conversation

carlomanf
Copy link

@carlomanf carlomanf commented Dec 10, 2020

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 or delete_others_archive_templates etc.

One "limitation" of this implementation is that some UI features are protected behind general capabilities like edit_templates and publish_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 and delete_single_templates. Then observe that if they create a single template, they can delete it, but if they create an archive template, they can not delete it.

Screenshots

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Dec 10, 2020
@carlomanf carlomanf changed the title Allow partial permissions for FSE theme templates Proof-of-concept: allow partial permissions for FSE theme templates Dec 10, 2020
@carlomanf
Copy link
Author

One limitation of this implementation is that some UI features are protected behind general capabilities like edit_templates and publish_templates and are not visible unless those general capabilities are granted.

Related: https://core.trac.wordpress.org/ticket/52023

# Conflicts:
#	lib/full-site-editing/templates.php
@carlomanf
Copy link
Author

Closing as outdated, but parts of the code can be re-used in an updated version.

@carlomanf carlomanf closed this Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository
Projects
None yet
2 participants