Answers.Body: <p>Note that the issue has now been reported as a gitlab and that is the place to follow along with it <a href="https://lab.civicrm.org/dev/core/-/issues/3671" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/-/issues/3671</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-18T22:29:52.100Z
Answers.LastActivityDate: 2022-06-18T22:29:52.100Z
Answers.UserDisplayName: eileen
Answers.Body: <p>We have confirmed that this is a regression in CiviCRM Core by writing an automated test for WFC module. It clearly shows that the latest public 5.45.* is still green -&gt; after that -&gt; red</p>
  <p>I have reported the issue in CiviCRM's product management channel. Hopefully it will be addressed quickly for you. Once it has been fixed we will merge this new UpdateCase test into the WFC module Github repo so it will run on every PR as well as against CiviCRM RC and even dev-master to ensure this exact issue will never resurface.</p>
  <p>If you want to help contribute to our work and efforts -&gt; consider making a contribution here -&gt; <a href="https://webform-civicrm.io/form/sponsor-webform-civicrm-module" rel="nofollow noreferrer">https://webform-civicrm.io/form/sponsor-webform-civicrm-module</a></p>
  <p><a href="https://i.sstatic.net/uMZlw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uMZlw.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-18T14:23:45.273Z
Answers.LastActivityDate: 2022-06-18T14:23:45.273Z
Answers.UserDisplayName: KarinG - Semper IT
Body: <p>We updated two different Test systems with the <a href="https://github.com/civicrm/civicrm-core/blob/5.49/release-notes/5.49.4.md" rel="nofollow noreferrer">CiviCRM Security Release (5.50.0, 5.49.4, 5.45.6 ESR)</a> from 1st of June 2022. One test system has Drupal7 and CiviCRM 5.49.4, the other one has Drupal9 and CiviCRM 5.49.4. (We updated the latter to CiviCRM 5.50.1, but the problem persists.)</p>
  <p>After the update, we cannot change Cases via Drupal Webform (which is using the CiviCRM API) anymore if we are logged in as a test user.
  When we try, the webform returns a success message, but the changes are not saved in CiviCRM and in the error protocoll it says:</p>
  <blockquote>
  <p>The CiviCRM &quot;case create&quot; API returned the error: &quot;Index 0 not found in api results&quot; when called by function &quot;postSave&quot; on line 222 of wf_crm_webform_postprocess.inc with parameters: &quot;Array ( [medium_id] =&gt; 1 [case_type_id] =&gt; 4 [status_id] =&gt; 1 [subject] =&gt; testsubject [custom_118] =&gt; [custom_283] =&gt; 1 [custom_6] =&gt; Array ( ) [custom_9] =&gt; [custom_120] =&gt; [custom_11] =&gt; [custom_128] =&gt; 0 [custom_12] =&gt; [custom_307] =&gt; 19940614 [custom_131] =&gt; Array ( ) [custom_15] =&gt; Array ( ) [custom_300] =&gt; [custom_139] =&gt; Array ( ) [custom_280] =&gt; [custom_18] =&gt; Array ( ) [custom_314] =&gt; Array ( ) [custom_26] =&gt; Array ( ) [custom_51] =&gt; Array ( ) [custom_121] =&gt; Array ( ) [custom_122] =&gt; Array ( ) [custom_294] =&gt; [custom_167] =&gt; 0 [custom_281] =&gt; Array ( ) [custom_295] =&gt; [custom_240] =&gt; [custom_288] =&gt; [custom_241] =&gt; [custom_290] =&gt; [custom_57] =&gt; Array ( ) [custom_249] =&gt; [custom_309] =&gt; [custom_81] =&gt; Array ( ) [custom_256] =&gt; [custom_308] =&gt; [custom_87] =&gt; Array ( ) [custom_270] =&gt; [custom_271] =&gt; [custom_272] =&gt; [custom_274] =&gt; Array ( ) [custom_92] =&gt; 0 [custom_93] =&gt; [custom_94] =&gt; [custom_95] =&gt; [custom_96] =&gt; [custom_97] =&gt; [custom_98] =&gt; [custom_277] =&gt; [client_id] =&gt; 2016 [id] =&gt; 3845 [check_permissions] =&gt; [version] =&gt; 3 ) &quot;</p>
  </blockquote>
  <p>We <em>can</em> change Cases via Drupal Webform as admins. Creating/changing Cases via the CiviCRM GUI works (as test user and admin), as well as creating/changing Cases using the CiviCRM API3 Explorer (as admin). As the latter works well, the problem cannot lie in the CiviCRM API itself, but it has to be an issue with the way Drupal webform calls the CiviCRM API. On the other hand, as the problem exists in both Drupal7 and Drupal9, and didn't occur in both of these systems before the CiviCRM Update, it cannot really be a problem in Drupal webform as well.</p>
  <p>Did anybody meet a similar problem when updating to this Security Release, and found out why? Does anybody know if this update changed something related to permission model / user roles? Any hint is appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-14T17:07:17.150Z
Comments.Text: The security release does contain a stricter check on permissions in some situations, but it's not immediately obvious why it affects this. And in the log above it says check_permissions is turned off.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-15T02:24:18.387Z
Comments.Text: Hi Emma - I have seen one other report of this. I’ll ask one of my team to look into it.
Comments.UserDisplayName: KarinG - Semper IT
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-15T07:18:51.010Z
Comments.Text: This is also affecting us in 5.49.5 (and Drupal 7). Some non-admin users can update cases with forms but there's no obvious pattern to their permissions, so far. We use ACLs and Drupal roles.
Comments.UserDisplayName: Patrick Lesslie
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-17T01:24:28.587Z
Comments.Text: Oh that does sound like permissions. Emma -> can you please update your D9/CiviCRM to 5.49.5 (you should that .4 -> .5 will fix some WFC errors as that point release update addressed an API regression in Core). Then try and reproduce the issue with Drupal 9. If you can reproduce it, please share your exact scenario/settings with us by exporting that form's config. We will then write a test that will cover that scenario (we have a test to Create a Case - but no Update one yet).
Comments.UserDisplayName: KarinG - Semper IT
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-18T14:18:15.547Z
Comments.Text: We already added the test (see answer)
Comments.UserDisplayName: KarinG - Semper IT
Tags: <webform-civicrm><civicase><upgrade>
Title: Cannot change cases via Drupal Webform after CiviCRM update
ThreadText: # Cannot change cases via Drupal Webform after CiviCRM update
  
  (Asked by: username_0 on 2022-06-14)
  
  We updated two different Test systems with the [CiviCRM Security Release (5.50.0, 5.49.4, 5.45.6 ESR)](https://github.com/civicrm/civicrm-core/blob/5.49/release-notes/5.49.4.md) from 1st of June 2022. One test system has Drupal7 and CiviCRM 5.49.4, the other one has Drupal9 and CiviCRM 5.49.4. (We updated the latter to CiviCRM 5.50.1, but the problem persists.)
  
  After the update, we cannot change Cases via Drupal Webform (which is using the CiviCRM API) anymore if we are logged in as a test user.
  When we try, the webform returns a success message, but the changes are not saved in CiviCRM and in the error protocoll it says:
  
  > The CiviCRM "case create" API returned the error: "Index 0 not found in api results" when called by function "postSave" on line 222 of wf\_crm\_webform\_postprocess.inc with parameters: "Array ( [medium\_id] => 1 [case\_type\_id] => 4 [status\_id] => 1 [subject] => testsubject [custom\_118] => [custom\_283] => 1 [custom\_6] => Array ( ) [custom\_9] => [custom\_120] => [custom\_11] => [custom\_128] => 0 [custom\_12] => [custom\_307] => 19940614 [custom\_131] => Array ( ) [custom\_15] => Array ( ) [custom\_300] => [custom\_139] => Array ( ) [custom\_280] => [custom\_18] => Array ( ) [custom\_314] => Array ( ) [custom\_26] => Array ( ) [custom\_51] => Array ( ) [custom\_121] => Array ( ) [custom\_122] => Array ( ) [custom\_294] => [custom\_167] => 0 [custom\_281] => Array ( ) [custom\_295] => [custom\_240] => [custom\_288] => [custom\_241] => [custom\_290] => [custom\_57] => Array ( ) [custom\_249] => [custom\_309] => [custom\_81] => Array ( ) [custom\_256] => [custom\_308] => [custom\_87] => Array ( ) [custom\_270] => [custom\_271] => [custom\_272] => [custom\_274] => Array ( ) [custom\_92] => 0 [custom\_93] => [custom\_94] => [custom\_95] => [custom\_96] => [custom\_97] => [custom\_98] => [custom\_277] => [client\_id] => 2016 [id] => 3845 [check\_permissions] => [version] => 3 ) "
  
  We *can* change Cases via Drupal Webform as admins. Creating/changing Cases via the CiviCRM GUI works (as test user and admin), as well as creating/changing Cases using the CiviCRM API3 Explorer (as admin). As the latter works well, the problem cannot lie in the CiviCRM API itself, but it has to be an issue with the way Drupal webform calls the CiviCRM API. On the other hand, as the problem exists in both Drupal7 and Drupal9, and didn't occur in both of these systems before the CiviCRM Update, it cannot really be a problem in Drupal webform as well.
  
  Did anybody meet a similar problem when updating to this Security Release, and found out why? Does anybody know if this update changed something related to permission model / user roles? Any hint is appreciated.
  
  **Tags:** webform-civicrm, civicase, upgrade
  
  > **Comments:**
  > **username_1**: The security release does contain a stricter check on permissions in some situations, but it's not immediately obvious why it affects this. And in the log above it says check_permissions is turned off.  
  > **username_2**: Hi username_0 - I have seen one other report of this. I’ll ask one of my team to look into it.  
  > **username_3**: This is also affecting us in 5.49.5 (and Drupal 7). Some non-admin users can update cases with forms but there's no obvious pattern to their permissions, so far. We use ACLs and Drupal roles.  
  > **username_2**: Oh that does sound like permissions. username_0 -> can you please update your D9/CiviCRM to 5.49.5 (you should that .4 -> .5 will fix some WFC errors as that point release update addressed an API regression in Core). Then try and reproduce the issue with Drupal 9. If you can reproduce it, please share your exact scenario/settings with us by exporting that form's config. We will then write a test that will cover that scenario (we have a test to Create a Case - but no Update one yet).  
  > **username_2**: We already added the test (see answer)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2022-06-18. Score: 3 | Accepted answer
  
  We have confirmed that this is a regression in CiviCRM Core by writing an automated test for WFC module. It clearly shows that the latest public 5.45.\* is still green -> after that -> red
  
  I have reported the issue in CiviCRM's product management channel. Hopefully it will be addressed quickly for you. Once it has been fixed we will merge this new UpdateCase test into the WFC module Github repo so it will run on every PR as well as against CiviCRM RC and even dev-master to ensure this exact issue will never resurface.
  
  If you want to help contribute to our work and efforts -> consider making a contribution here -> <https://webform-civicrm.io/form/sponsor-webform-civicrm-module>
  
  [![enter image description here](https://i.sstatic.net/uMZlw.png)](https://i.sstatic.net/uMZlw.png)
  
  
  ---
  
  ### Answer by username_4 on 2022-06-18. Score: 2
  
  Note that the issue has now been reported as a gitlab and that is the place to follow along with it <https://lab.civicrm.org/dev/core/-/issues/3671>
  
  
  ---
  
  