Answers.Body: <p>I've posted <a href="https://issues.civicrm.org/jira/browse/CRM-18116?focusedCommentId=86706&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-86706" rel="noreferrer">a preliminary fix in JIRA</a>.</p>
  
  <p>Joseph</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-22T11:39:26.317Z
Answers.Text: This fix was released in 4.7.9
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-22T20:53:53.460Z
Answers.LastActivityDate: 2016-03-22T20:53:53.460Z
Answers.UserDisplayName: Joseph Lacey
Body: <p>first post so please forgive any netiquette transgressions.  I'm following the guide <a href="https://civicrm.org/bug-reporting" rel="nofollow">https://civicrm.org/bug-reporting</a> to get confirmation this is a bug.</p>
  
  <p>Version: 4.6.12 (also present in 4.7.1)</p>
  
  <p>CMS: Wordpress</p>
  
  <p><strong>* Bug description *</strong></p>
  
  <p>User 1 (admin) creates a case and assigns a role to user 2.  User 1 creates an activity on this case and assigns the activity to user 2.</p>
  
  <p>User2 has the ACL role "edit my activities and cases" and logs in.  They can see their case and Manage it.  When user2 clicks the Edit link alongside the activity user1 assigned to them they get an error, "Sorry an Error Occured
  You are not authorised to access this page.".  </p>
  
  <p>This also generates the following in the Apache error log:</p>
  
  <p>PHP Warning:  array_key_exists(): The first argument should be either a string or an integer in /wp-content/plugins/civicrm/civicrm/CRM/Case/Form/Activity.php on line 121, referer: <a href="https://ourtestdomain.co.uk/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fcontact%2Fview%2Fcase&amp;reset=1&amp;id=3&amp;cid=16&amp;action=view&amp;context=dashboard&amp;selectedChild=case" rel="nofollow">https://ourtestdomain.co.uk/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fcontact%2Fview%2Fcase&amp;reset=1&amp;id=3&amp;cid=16&amp;action=view&amp;context=dashboard&amp;selectedChild=case</a></p>
  
  <p>Line 121 should be passing a case ID into the array_key_exists() call and that case ID should be an int or a string.  The comment at the top of Activity.php suggests that the original author expected it to be an int.  However the variable passed holds an object that contains the case id in question.  This generates the warning in the error log and the pop-up seen by the user.  If the case id is extracted from the object and passed into array_key_exists the user can edit the activity.</p>
  
  <p>User2 has permission to edit this activity and I believe its a bug that they cannot.</p>
  
  <p>NB because of the need for multiple users I haven't been able to recreate this on the demo install where you only have one user.</p>
  
  <p>If you could confirm this I will file a bug report per step 7 of the guide.</p>
  
  <p>Many thanks.</p>
  
  <p>axa</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-24T04:43:29.090Z
Comments.Text: I would comment on your question instead of "answering" it, but I don't have the ability to comment yet. I found your question because I've run into the same issue with a local Wordpress install of Civi version 4.7.2 using multiple test users.
Comments.UserDisplayName: rui
Tags: <civicase><activities><permissions><acl><roles>
Title: Users with Case roles cannot edit activities assigned to them: is this a bug?
ThreadText: # Users with Case roles cannot edit activities assigned to them: is this a bug?
  
  (Asked by: username_0 on 2016-02-16)
  
  first post so please forgive any netiquette transgressions. I'm following the guide <https://civicrm.org/bug-reporting> to get confirmation this is a bug.
  
  Version: 4.6.12 (also present in 4.7.1)
  
  CMS: Wordpress
  
  **\* Bug description \***
  
  User 1 (admin) creates a case and assigns a role to user 2. User 1 creates an activity on this case and assigns the activity to user 2.
  
  User2 has the ACL role "edit my activities and cases" and logs in. They can see their case and Manage it. When user2 clicks the Edit link alongside the activity user1 assigned to them they get an error, "Sorry an Error Occured
  You are not authorised to access this page.".
  
  This also generates the following in the Apache error log:
  
  PHP Warning: array\_key\_exists(): The first argument should be either a string or an integer in /wp-content/plugins/civicrm/civicrm/CRM/Case/Form/Activity.php on line 121, referer: <https://ourtestdomain.co.uk/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fcontact%2Fview%2Fcase&reset=1&id=3&cid=16&action=view&context=dashboard&selectedChild=case>
  
  Line 121 should be passing a case ID into the array\_key\_exists() call and that case ID should be an int or a string. The comment at the top of Activity.php suggests that the original author expected it to be an int. However the variable passed holds an object that contains the case id in question. This generates the warning in the error log and the pop-up seen by the user. If the case id is extracted from the object and passed into array\_key\_exists the user can edit the activity.
  
  User2 has permission to edit this activity and I believe its a bug that they cannot.
  
  NB because of the need for multiple users I haven't been able to recreate this on the demo install where you only have one user.
  
  If you could confirm this I will file a bug report per step 7 of the guide.
  
  Many thanks.
  
  axa
  
  **Tags:** civicase, activities, permissions, acl, roles
  
  > **Comments:**
  > **username_1**: I would comment on your question instead of "answering" it, but I don't have the ability to comment yet. I found your question because I've run into the same issue with a local Wordpress install of Civi version 4.7.2 using multiple test users.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-03-22. Score: 5
  
  I've posted [a preliminary fix in JIRA](https://issues.civicrm.org/jira/browse/CRM-18116?focusedCommentId=86706&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-86706).
  
  username_2
  
  > **Comments:**
  > **username_3**: This fix was released in 4.7.9  
  
  ---
  
  