-
Notifications
You must be signed in to change notification settings - Fork 33
Permissions: Allow overriding of PCH feature permissions #2663
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
Permissions: Allow overriding of PCH feature permissions #2663
Conversation
…ent_user_can_use_pch_feature` method.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Base branches to auto review (4)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Co-authored-by: Alex Cicovic <23142906+acicovic@users.noreply.github.com>
Description
We got reports that VIP support users were unable to access PCH features after the introduction of PCH permissions.
This PR gives a pathway to fix this. It introduces a new filter,
wp_parsely_current_user_can_use_pch_feature, to thecurrent_user_can_use_pch_featurefunction in theclass-permissions.phpfile. This filter allows developers to override the default permissions check for specific Content Helper features.By using the filter, we'll now be able to grant PCH feature access to VIP support users.
The filter provides several parameters:
$current_user_can_use_pch_feature(bool) to indicate whether the current user can use the feature$feature_name(string) for the feature's name$current_user(\WP_User) representing the current user object$post_id(int|false) for the post ID if the check is for a specific post. If the filter returnstrue, the function immediately grants permission, bypassing the default role-based check.This change allows more flexibility for customizing each feature permission based on specific requirements. Here's an example on how you could use to allow a specific role to have access to the Smart Linking feature.
Motivation and context
Improve the flexibility and extensibility of PCH access control.
How has this been tested?
Tested locally.