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

Switch to non deprecated buildPermissionClause() for contact summary report #20287

Merged
merged 1 commit into from
May 14, 2021

Conversation

mattwire
Copy link
Contributor

Overview

Swap deprecated buildACLClause() for non-deprecated buildPermissionClause(). On a site using ACLs restricted users were seeing multiple duplicates when refreshing the report - this was caused by the INNER JOIN on the civicrm_acl_contact_cache that was being added and is not required.

Before

Duplicates for users using ACLs when refreshing the report.

After

No duplicates.

Technical Details

Described above.

Comments

@civibot civibot bot added the master label May 13, 2021
@civibot
Copy link

civibot bot commented May 13, 2021

(Standard links)

// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);

$this->buildPermissionClause();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this gets called already from buildQuery() right below? If you just remove the line does that fix the problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. It works just removing the buildACLClause line

@mattwire mattwire force-pushed the contactreportaclduplicates branch from 4f40f5f to 514feb6 Compare May 13, 2021 22:13
@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented May 13, 2021

This looks correct to me - I'll leave to you to merge when you are happy with it @demeritcowboy

@eileenmcnaughton
Copy link
Contributor

I took a quick look & there are several reports still with this - the Contact/Detail one looks almost identical to this

@demeritcowboy
Copy link
Contributor

  • General standards
    • [r-explain] PASS
      • I can sort of reproduce the problem, although I only get one duplicate record - for the contact of the logged-in user - but maybe the exact results depend on some other factors and what ACLs are set up.
    • [r-user] PASS
    • [r-doc] PASS
    • [r-run] PASS
      • Duplicate gone. ACL restriction still seems to work.
  • Developer standards
    • [r-tech] Soft PASS
      • My only hesitation is I don't use ACLs much so am not completely sure what to look out for, but (a) it was calling buildPermissionClause() before via buildQuery() so it's not doing anything new that it didn't before, and (b) it's limited to this report.
    • [r-code] PASS
    • [r-maint] ?
    • [r-test] PASS

@demeritcowboy demeritcowboy merged commit fe7aaff into civicrm:master May 14, 2021
@demeritcowboy
Copy link
Contributor

demeritcowboy commented May 14, 2021

And you're right the constituent detail seems to have the same duplicate problem.

There is also a separate problem with the constituent summary if you use force=1 but ... sigh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants