CRM_Utils_System::civiExit();
}
try {
- // Call multiple
+ // Two call formats. Which one was used? Note: CRM_Api4_Permission::check() and CRM_Api4_Page_AJAX::run() should have matching conditionals.
if (empty($this->urlPath[3])) {
+ // Received multi-call format
$calls = CRM_Utils_Request::retrieve('calls', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'POST');
$calls = json_decode($calls, TRUE);
$response = [];
$response[$index] = call_user_func_array([$this, 'execute'], $call);
}
}
- // Call single
else {
+ // Received single-call format
$entity = $this->urlPath[3];
$action = $this->urlPath[4];
$params = CRM_Utils_Request::retrieve('params', 'String');
$defaultPermissions = [
['access CiviCRM', 'access AJAX API'],
];
+ // Two call formats. Which one was used? Note: CRM_Api4_Permission::check() and CRM_Api4_Page_AJAX::run() should have matching conditionals.
if (!empty($urlPath[3])) {
+ // Received single-call format
$entity = $urlPath[3];
$action = $urlPath[4];
$permissions = $defaultPermissions;
return CRM_Core_Permission::check($permissions);
}
else {
+ // Received multi-call format
$calls = CRM_Utils_Request::retrieve('calls', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'POST');
$calls = json_decode($calls, TRUE);
foreach ($calls as $call) {