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

Fix another Financial Type ACL bug #32206

Open
wants to merge 3 commits into
base: 6.0
Choose a base branch
from

Conversation

MegaphoneJon
Copy link
Contributor

Overview

While writing a test for #32189, I found two issues:

  • My last change reintroduced the bug I was trying to solve, but only in some scenarios, because getAvailableFinancialTypes() gets a value passed by reference AND returns a value.
  • The expected behavior for adding and removing ACLs without clearing cache is different.

Before

Sometimes, permissions for financial types with mismatched names/labels are incorrect.

After

Fixed.

Comments

This became much more complicated because the test seems to suggest that removing financial ACL permissions should have an immediate effect, even if adding financial ACL permissions requires a cache clear. Does that make sense? I don't know. But I had to jump through some hoops to maintain the original behavior.

Copy link

civibot bot commented Feb 24, 2025

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers...

➡️ Online demo of this PR 🔗

@civibot civibot bot added the 6.0 label Feb 24, 2025
@MegaphoneJon MegaphoneJon added has-test and removed 6.0 labels Feb 24, 2025
@MegaphoneJon
Copy link
Contributor Author

The test results are all over the place, I'm going to assume something is going on with the infra and I'll wait to retest this.

@mlutfy mlutfy changed the title fix another fintype bug Fix another Financial Type ACL bug Feb 24, 2025
@seamuslee001
Copy link
Contributor

Jenkins re test this please

…ypes pass by reference is correctly updated as well as the returned value
@seamuslee001
Copy link
Contributor

@MegaphoneJon do you think we need to include anything in the release notes because I imagine that for those that have granted financial type ACLs they may need to re-set them because the permission key has changed right?

@demeritcowboy
Copy link
Contributor

I don't use financial acls anywhere, but this seems ok. That's so strange how it takes a seed list parameter and updates it but then also returns a list.

While your heads are in name/label/financial space don't suppose anyone wants to look at #32085? It's the same as 32084 (merged) just in a different spot.

Separately while looking at this I did find yet a few other places still using name instead of label. TBD.

@demeritcowboy demeritcowboy added the merge ready PR will be merged after a few days if there are no objections label Feb 27, 2025
@MegaphoneJon
Copy link
Contributor Author

@MegaphoneJon do you think we need to include anything in the release notes because I imagine that for those that have granted financial type ACLs they may need to re-set them because the permission key has changed right?

@seamuslee001 no. The permission always used name, which is correct. The problem is getAvailableFinancialTypes was comparing the labels in civicrm_financial_type to the name of the permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.0 has-test merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants