Add filter to bypass the Delete/Update Term permission check in SyncManager #2020
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 of the Change
This change will add a hook to override the permission check when deleting/updating terms. This feature already exists in the Post SyncManager when deleting and updating.
Alternate Designs
This code will mirror how it's currently done in the Post SyncManager but the code could be expanded to include the
DOING_CRON
conditions in the delete action for both term and post so the logic is more similar. It could be argued to be outside this scope since the current/initial PR suggestion will simply add opt-in features whereas adding CRON conditions changes default behavior.Benefits
Allows developers to bypass the user permission check for operations that happens outside logged in environments (CLI etc).
Possible Drawbacks
Could allow for developers to create their own "vulnerability" so others can delete/updating terms without user permission but is not inherently true by default. I'm guessing this is not something you're too worried about (like me) since it already exists in the Post SyncManager.
Verification Process
Checklist:
Applicable Issues
Changelog Entry
Added filter to bypass user permission check before deleting/updating terms from index.