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 Fix issue where multiple activity Ids were not supported wh… #10212

Merged
merged 1 commit into from
Apr 22, 2017

Conversation

seamuslee001
Copy link
Contributor

…en check permissions was used

@seamuslee001
Copy link
Contributor Author

@davejenx @eileenmcnaughton @monishdeb Hey Folks i'm 99% sure this will fix the breakage Dave found. Dave are you able to test this?

@eileenmcnaughton eileenmcnaughton merged commit 26a4382 into civicrm:4.7.19-rc Apr 22, 2017
@eileenmcnaughton
Copy link
Contributor

Looks good - thanks!

@seamuslee001
Copy link
Contributor Author

just pasting here from Mattermost: @JohnFF "@seamuslee looks good"

@seamuslee001 seamuslee001 deleted the CRM-20441 branch April 22, 2017 23:14
@davejenx
Copy link
Contributor

davejenx commented Apr 24, 2017

@seamuslee001 Just tested the current 4.7.19-rc branch and I now get a different fatal error on contact view as an ACL'd user with just "access CiviCRM" + ACL view for one group.
"Sorry but we are not able to provide this at the moment.
You do not have permission to view this activity"
That error is happening on /civicrm/contact/view?reset=1&cid=X where X is the id of any contact that the user is permitted to view and that has activities. I'm not expecting to see this message when trying to view contact summary.

Backtrace:
#0 .../dmaster/sites/all/modules/civicrm/CRM/Core/Error.php(456): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 .../dmaster/sites/all/modules/civicrm/CRM/Core/Invoke.php(55): CRM_Core_Error::handleUnhandledException(Object(CiviCRM_API3_Exception))
#2 .../dmaster/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3))
#3 internal function: civicrm_invoke("contact", "view")
#4 .../dmaster/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
#5 .../dmaster/index.php(21): menu_execute_active_handler()
#6 {main}

@seamuslee001
Copy link
Contributor Author

@davejenx

So first off that makes some sort of sense to a degree as its probably trying to get a count of the number of activities

  1. From what i have seen to view an activity you need access to all 2 / 3 contacts involved (source + target if no assignee or if there is one you need to have access to the assignee as well)

In that respect i believe that this is a new issue rather than the same issue as CRM-20441 as CRM-20441 was dealing with the problem where the check was failing as it couldn't interpret multiple ids. Here it is handling that and failing This is the function which is killing things for you https://github.com/civicrm/civicrm-core/blob/master/CRM/Activity/BAO/Activity.php#L2084

@seamuslee001
Copy link
Contributor Author

@colemanw Coleman Can you please comment on Dave's latest error as to what we should do, It appears it is correctly checking permissions now but that check is failing

$ids = array();
if (is_array($params['id'])) {
foreach ($params['id'] as $operator => $values) {
if (in_array($operator, CRM_Core_DAO::acceptedSQLOperators())) {
Copy link
Member

Choose a reason for hiding this comment

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

This could result in permission escalation if the operator is not "IN". E.g. passing 'id' => array('NOT IN' => 123) would let you see all activities if you have access to view 123.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@colemanw should we limit it to just IN for the moment or include Like as well?

@colemanw
Copy link
Member

colemanw commented Apr 24, 2017 via email

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

Successfully merging this pull request may close these issues.

4 participants