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

Return from getACLRoles when contactID is not null #19871

Merged
merged 1 commit into from
Mar 23, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Mar 23, 2021

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

I've made this patch the least possible code wise to allow brain space to think about the query....

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

(once this is merged more cleanup can happen but I wanted to
make this change easy to think through)
@civibot
Copy link

civibot bot commented Mar 23, 2021

(Standard links)

@civibot civibot bot added the master label Mar 23, 2021
@eileenmcnaughton eileenmcnaughton changed the title Return from getACLRoles when contactID is null Return from getACLRoles when contactID is not null Mar 23, 2021
@seamuslee001
Copy link
Contributor

@eileenmcnaughton I agree with your thinking about what happens but I think its problematic but that should be addressed in a separate PR MOP

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 spoiler alert - the whole function does nothing

@eileenmcnaughton
Copy link
Contributor Author

This #19872 is a bit like turning to the last page

@seamuslee001 seamuslee001 merged commit 155089e into civicrm:master Mar 23, 2021
@seamuslee001 seamuslee001 deleted the acl branch March 23, 2021 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants