Afform.prefill - Allow anonymous requests
authorTim Otten <totten@civicrm.org>
Thu, 4 Feb 2021 03:46:12 +0000 (19:46 -0800)
committerTim Otten <totten@civicrm.org>
Thu, 4 Feb 2021 04:15:13 +0000 (20:15 -0800)
This API has its own security checks

ext/afform/core/afform.php

index 54fe6e8c6eae32901ff6ef868af1afcc5d31175a..87c4e243375693b7f8668fc5649d98e9a167674e 100644 (file)
@@ -394,7 +394,9 @@ function _afform_angular_module_name($fileBaseName, $format = 'camel') {
  * @see CRM_Utils_Hook::alterApiRoutePermissions
  */
 function afform_civicrm_alterApiRoutePermissions(&$permissions, $entity, $action) {
-  if ($entity == 'Afform' && $action == 'submit') {
-    $permissions = CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION;
+  if ($entity == 'Afform') {
+    if ($action == 'prefill' || $action == 'submit') {
+      $permissions = CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION;
+    }
   }
 }