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 checking permissions in api3 profile get #16848

Merged
merged 1 commit into from
Mar 19, 2020

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Mar 19, 2020

Overview

Fixes an apparent bug in api3 code where a boolean value needs to be inverted.

Technical Details

This is confusing so I'm gonna break it down here as much for myself as anyone reading this:

  • civicrm_api3_profile_get takes a param called check_permissions.
    If true, permissions will be checked.
  • CRM_Core_BAO_UFGroup::getFields takes a param called $skipPermission.
    If true, permissions will not be checked.
  • The expression being passed into $skipPermission was empty($params['check_permissions']) ? FALSE : TRUE.
    That's a confusing way of saying a = a; the value stays the same.
  • The problem is that the two functions expect their respective permission params to have opposite meanings, so in passing this param through from one function to the other, it needs to be inverted.

Comments

Whew! Brain hurts.

The boolean being passed to the $skipPermission param was reversed.
@civibot civibot bot added the master label Mar 19, 2020
@civibot
Copy link

civibot bot commented Mar 19, 2020

(Standard links)

@colemanw
Copy link
Member Author

@eileenmcnaughton I came across this randomly while fixing up bool expressions. Haven't tried running it and I doubt there's any test coverage.

retest this please

@eileenmcnaughton
Copy link
Contributor

I agree!

@eileenmcnaughton eileenmcnaughton merged commit fd04bde into civicrm:master Mar 19, 2020
@eileenmcnaughton eileenmcnaughton deleted the profilePerms branch March 19, 2020 20:37
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.

2 participants