6

I have tried to enable the access to the Access my cases and activities as per The docs here - https://docs.civicrm.org/user/en/latest/case-management/set-up/

Access my cases and activities: allows a user to create new cases, add activities to the cases they've created and edit those activities. Users with this permission can NOT see cases or activities created by others.

However, whenever a user with that permission tries to access their own case they get an access denied. I think it has to do with the edit activities that are in cases. Has anyone else had this issue. It makes the "Access my cases and activities" permission unusable.

Using CiviCRM Version 5.3.2 and Drupal 7.59

  • New Problem? in Civi 5.6.1 - if you check "access my cases and activities" but do not have "Access ALL Cases and activities" when you go to access the Case dashboard or Manage Cases the account gets "ERR_TOO_MANY_REDIRECTS" And we can't give access to all Cases...? – Br. Mark Waldmann Nov 6 '18 at 20:14
  • Looks like you did some digging and found it's extension-related, so just posting the update for others looking: github.com/civicrm/org.civicrm.civicase/issues/120 – Demerit Nov 7 '18 at 21:27
3

This looks like a bug. It's coming from CRM_Case_Page_Tab::preProcess(), which calls CRM_Case_BAO_Case::getCases(), which then returns a list that's keyed sequentially, but then preProcess checks for a key that matches the case id, so there is no match.

$userCases = CRM_Case_BAO_Case::getCases(FALSE, array('type' => 'any'));
if (!array_key_exists($this->_id, $userCases)) {
  CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}

This appears to have inadvertently been changed as part of CRM-21461. I'll file a bug report.

  • Thanks @Demerit. Appreciate you taken the time to check this and identify it as a core bug. – Sohal Khatwani Aug 1 '18 at 12:27
  • 1
    If you want a quick hack, try changing line 679 in CRM/Case/BAO/Case.php from foreach ($result->fetchAll() as $key => $case) { to foreach ($result->fetchAll() as $case) { $key = $case['case_id'];, but I haven't tested for side effects. – Demerit Aug 1 '18 at 12:32
  • Hi @Demerit. Thanks for the suggestion and raising the bug. Hopefully the core team can fix this soon. – Sohal Khatwani Aug 2 '18 at 5:44
3

This was a regression which is now being fixed. See https://github.com/civicrm/civicrm-core/pull/12613

  • Thanks @Coleman - Is this available in the latest CiviCRM 5.4 release? – Sohal Khatwani Aug 26 '18 at 9:43
  • Looks like there was a delay in getting it merged so it will be in 5.6. – Coleman Aug 27 '18 at 0:17
  • Thanks @Coleman & Demerit and the CiviCRM team for fixing this issue. – Sohal Khatwani Aug 28 '18 at 1:02
2

Can you try this patch https://github.com/civicrm/org.civicrm.civicase/pull/123

Hope that helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.