Closed
Conversation
Allows plugins to grant or deny agent access based on custom logic (e.g. team membership, organization roles, subscription status). Filter receives: $can_access, $agent_id, $user_id, $minimum_role. Return true to grant access, false to deny.
Contributor
Homeboy Results —
|
Member
Author
|
Merged to main — proceeding with release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a
datamachine_can_access_agentfilter toPermissionHelper::can_access_agent(), allowing plugins to grant or deny agent access based on custom logic (e.g. team membership, organization roles, subscription status).What changed
inc/Abilities/PermissionHelper.php—can_access_agent()now appliesdatamachine_can_access_agentfilter after the default access check (admin/owner/explicit grants)Filter signature
Consumers can return
trueto grant access orfalseto deny, overriding the default.Why
The frontend chat widget (
data-machine-frontend-chat) usescan_access_agent()to determine widget visibility. EC has a custom team membership system (ec_is_team_member()) that needs to grant access to the roadie agent. Without this filter, there's no way for external plugins to extend agent access without directly inserting rows intoagent_access.Testing
apply_filterscall, defaulting to the existing$can_accessvalue