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

CRM-20441 further fixes & tests for api + acl #10251

Merged
merged 3 commits into from
Apr 26, 2017

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Apr 25, 2017

@eileenmcnaughton
Copy link
Contributor Author

This is not quite there yet - but I think the trick is here
https://github.com/civicrm/civicrm-core/compare/master...eileenmcnaughton:4.7.19-rc2?expand=1#diff-7673c7d055caeab2a3ec5d05a1553293R328

We just need to get the ACL adder to add a permissioned join onto ACL_Contact - pretty much whenever

@eileenmcnaughton eileenmcnaughton force-pushed the 4.7.19-rc2 branch 4 times, most recently from c56cb6b to f0a2c92 Compare April 26, 2017 00:10
@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 @colemanw @monishdeb @davejenx

I think this is the right fix for now.....

If moves all ACL checking to the api & it checks all rows if permissions are set. This is an expansion of our api application. I think we could do better next round by doing a join check rather than row-by-row & I have commented where I see us adding it.

There is a performance cost in some cases of doing this check - we should keep improving on that, however, it might not have much impact since previously we were blocking if id was not set or contact_id was set, now we are checking those. We were already checking in the other scenarios.

Also, the api no longer throws exceptions when permissions checks fail on a per-activity basis - that is correct from an api POV but we should do a click-around.

@colemanw I couldn't figure out how to force an ACL'd join on the contact_id table, so fell back to the row-by-row check. I would like to know how, although probably we should change all places that call the check function to call the api first, then optimise it within the api

@eileenmcnaughton
Copy link
Contributor Author

Per discussion in JIRA I have changed the behaviour on 2 tests - turns out one was written by Seamus & one by me, in order to set a baseline for changing behaviour

$params['id'] now supports NOT IN etc & test altered to reflect. 'view all activities' is not required when $params['id'] is empty. Instead there is a post-filter

@eileenmcnaughton eileenmcnaughton changed the title CRM-20441 add test for no activities viewable CRM-20441 further fixes & tests for api + acl Apr 26, 2017
@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 what do you think? Merge this now? I'm inclined to on the basis it

  1. extends test coverage
  2. gets existing tests passing
  3. has a negative score DESPITE adding tests
  4. will mean the rc has our latest code merged into the rc & master for review by @davejenx & those other hoards!

@seamuslee001
Copy link
Contributor

Agreed

@eileenmcnaughton eileenmcnaughton merged commit 881d82e into civicrm:4.7.19-rc Apr 26, 2017
@eileenmcnaughton eileenmcnaughton deleted the 4.7.19-rc2 branch April 26, 2017 04:27
@davejenx
Copy link
Contributor

Reverted my cherry-picking for the previous PRs, rebased to a clean 4.7.19-rc and checked that #10251 was in git log. Then re-tested. Success: this fix also worked...

Fixes the fatal error. Contact summary now displays, with Activities tab showing count = 0.

As a further test, I tried adding an activity to one of the allowed contacts that didn't have any activities. I set source = one of the allowed contacts, target = another of the allowed contacts, no assignee. So that should be visible to the restricted user - and it is: count = 1 on Activities tab, can view activity.

Hooray! Have commented on CRM-20441.

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.

4 participants