Return from getACLRoles when contactID is not null #19871
Merged
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.
Overview
Return empty array from getACLRoles when contactID is null
This one line patch is the thinking part of cleaning up this function - ie it involves reading through the code & figuring out why the query doesn't make sense / will never return anything if contact_id is not empty.
Before
getACLRoles always returns empty when $contact_id is not NULL - but it hurts our brains
Basically the where is
WHERE acl.entity_table='civicrm_acl_role'....
if contact_id is set it becomes
AND acl.entity_table = 'civicrm_contact'
Which means that it would only ever return empty results
After
getACLRoles always returns empty when $contact_id is not NULL - but with less pain
Technical Details
I've made this patch the least possible code wise to allow brain space to think about the query....
(once this is merged more cleanup can happen but I wanted to
make this change easy to think through)
Comments
@colemanw @seamuslee001 this really is the state of the acl code - it's mad