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

2
  • 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...? Commented Nov 6, 2018 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
    Commented Nov 7, 2018 at 21:27

3 Answers 3

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.

4
  • lab.civicrm.org/dev/core/issues/297
    – Demerit
    Commented Aug 1, 2018 at 4:27
  • Thanks @Demerit. Appreciate you taken the time to check this and identify it as a core bug. Commented Aug 1, 2018 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
    Commented Aug 1, 2018 at 12:32
  • Hi @Demerit. Thanks for the suggestion and raising the bug. Hopefully the core team can fix this soon. Commented Aug 2, 2018 at 5:44
3

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

3
  • Thanks @Coleman - Is this available in the latest CiviCRM 5.4 release? Commented Aug 26, 2018 at 9:43
  • Looks like there was a delay in getting it merged so it will be in 5.6.
    – Coleman
    Commented Aug 27, 2018 at 0:17
  • Thanks @Coleman & Demerit and the CiviCRM team for fixing this issue. Commented Aug 28, 2018 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 and acknowledge you have read our privacy policy.

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