Answers.Body: <p>This was a regression which is now being fixed. See <a href="https://github.com/civicrm/civicrm-core/pull/12613" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/12613</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-26T09:43:46.197Z
Answers.Text: Thanks @Coleman - Is this available in the latest CiviCRM 5.4 release?
Answers.UserDisplayName: Sohal Khatwani
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-27T00:17:23.857Z
Answers.Text: Looks like there was a delay in getting it merged so it will be in 5.6.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-28T01:02:55.460Z
Answers.Text: Thanks @Coleman & Demerit and the CiviCRM team for fixing this issue.
Answers.UserDisplayName: Sohal Khatwani
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-06T01:52:52.957Z
Answers.LastActivityDate: 2018-08-06T01:52:52.957Z
Answers.UserDisplayName: Coleman
Answers.Body: <p>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.</p>
  
  <pre><code>$userCases = CRM_Case_BAO_Case::getCases(FALSE, array('type' =&gt; 'any'));
  if (!array_key_exists($this-&gt;_id, $userCases)) {
    CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
  }
  </code></pre>
  
  <p>This appears to have inadvertently been changed as part of <a href="https://issues.civicrm.org/jira/browse/CRM-21461" rel="nofollow noreferrer" title="CRM-21461">CRM-21461</a>. I'll file a bug report.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-01T04:27:58.447Z
Answers.Text: https://lab.civicrm.org/dev/core/issues/297
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-01T12:27:44.037Z
Answers.Text: Thanks @Demerit. Appreciate you taken the time to check this and identify it as a core bug.
Answers.UserDisplayName: Sohal Khatwani
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-01T12:32:17.827Z
Answers.Text: 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.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-02T05:44:17.763Z
Answers.Text: Hi @Demerit. Thanks for the suggestion and raising the bug. Hopefully the core team can fix this soon.
Answers.UserDisplayName: Sohal Khatwani
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-31T13:54:21.640Z
Answers.LastActivityDate: 2018-08-01T04:15:03.360Z
Answers.LastEditDate: 2018-08-01T04:15:03.360Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>Can you try this patch <a href="https://github.com/civicrm/org.civicrm.civicase/pull/123" rel="nofollow noreferrer">https://github.com/civicrm/org.civicrm.civicase/pull/123</a></p>
  
  <p>Hope that helps!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-24T04:59:08.810Z
Answers.LastActivityDate: 2018-12-24T04:59:08.810Z
Answers.UserDisplayName: Yashodha Chaku
Body: <p>I have tried to enable the access to the Access my cases and activities as per The docs here - <a href="https://docs.civicrm.org/user/en/latest/case-management/set-up/" rel="noreferrer">https://docs.civicrm.org/user/en/latest/case-management/set-up/</a></p>
  
  <p>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.</p>
  
  <p>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. </p>
  
  <p>Using CiviCRM Version 5.3.2 and Drupal 7.59</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-06T20:14:36.437Z
Comments.Text: 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...?
Comments.UserDisplayName: Br. Mark Waldmann
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-07T21:27:48.703Z
Comments.Text: Looks like you did some digging and found it's extension-related, so just posting the update for others looking: https://github.com/civicrm/org.civicrm.civicase/issues/120
Comments.UserDisplayName: Demerit
Tags: <civicase><permissions>
Title: Problem with CiviCase
ThreadText: # Problem with CiviCase
  
  (Asked by: username_0 on 2018-07-31)
  
  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
  
  **Tags:** civicase, permissions
  
  > **Comments:**
  > **username_1**: 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...?  
  > **username_2**: Looks like you did some digging and found it's extension-related, so just posting the update for others looking: https://github.com/civicrm/org.civicrm.civicase/issues/120  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2018-08-06. Score: 3
  
  This was a regression which is now being fixed. See <https://github.com/civicrm/civicrm-core/pull/12613>
  
  > **Comments:**
  > **username_0**: Thanks @username_3 - Is this available in the latest CiviCRM 5.4 release?  
  > **username_3**: Looks like there was a delay in getting it merged so it will be in 5.6.  
  > **username_0**: Thanks @username_3 & username_2 and the CiviCRM team for fixing this issue.  
  
  ---
  
  ### Answer by username_2 on 2018-07-31. Score: 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](https://issues.civicrm.org/jira/browse/CRM-21461 "CRM-21461"). I'll file a bug report.
  
  > **Comments:**
  > **username_2**: https://lab.civicrm.org/dev/core/issues/297  
  > **username_0**: Thanks @username_2. Appreciate you taken the time to check this and identify it as a core bug.  
  > **username_2**: 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.  
  > **username_0**: Hi @username_2. Thanks for the suggestion and raising the bug. Hopefully the core team can fix this soon.  
  
  ---
  
  ### Answer by username_4 on 2018-12-24. Score: 2
  
  Can you try this patch <https://github.com/civicrm/org.civicrm.civicase/pull/123>
  
  Hope that helps!
  
  
  ---
  
  