From b6e769acfa2bd5947b00e609df9853fcad4c339c Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Sat, 1 May 2021 12:08:03 -0400 Subject: [PATCH] fix capitalization to allow proper access to 'access AJAX API' perm. Maybe this is platform dependent? On my dev instance the access AJAX API permission to the path /civicrm/ajax/api4/X/X is always denied for anon users because anon users are granted "access AJAX API" yet the check is done against "access Ajax API". This only really matters in CRM/Api4/Permission.php but to avoid any confusion I'm changing it everywhere the string appears. --- CRM/Api4/Permission.php | 2 +- CRM/Core/Permission.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CRM/Api4/Permission.php b/CRM/Api4/Permission.php index a5c9c9aa62..c179ad57c0 100644 --- a/CRM/Api4/Permission.php +++ b/CRM/Api4/Permission.php @@ -25,7 +25,7 @@ class CRM_Api4_Permission { $config = CRM_Core_Config::singleton(); $urlPath = explode('/', $_GET[$config->userFrameworkURLVar]); $permissions = [ - ['access CiviCRM', 'access Ajax API'], + ['access CiviCRM', 'access AJAX API'], ]; if (!empty($urlPath[3])) { $entity = $urlPath[3]; diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php index 6966296205..ff27b7f9f6 100644 --- a/CRM/Core/Permission.php +++ b/CRM/Core/Permission.php @@ -69,24 +69,24 @@ class CRM_Core_Permission { * Ex 1: Must have 'access CiviCRM' * (string) 'access CiviCRM' * - * Ex 2: Must have 'access CiviCRM' and 'access Ajax API' - * ['access CiviCRM', 'access Ajax API'] + * Ex 2: Must have 'access CiviCRM' and 'access AJAX API' + * ['access CiviCRM', 'access AJAX API'] * - * Ex 3: Must have 'access CiviCRM' or 'access Ajax API' + * Ex 3: Must have 'access CiviCRM' or 'access AJAX API' * [ - * ['access CiviCRM', 'access Ajax API'], + * ['access CiviCRM', 'access AJAX API'], * ], * - * Ex 4: Must have 'access CiviCRM' or 'access Ajax API' AND 'access CiviEvent' + * Ex 4: Must have 'access CiviCRM' or 'access AJAX API' AND 'access CiviEvent' * [ - * ['access CiviCRM', 'access Ajax API'], + * ['access CiviCRM', 'access AJAX API'], * 'access CiviEvent', * ], * * Note that in permissions.php this is keyed by the action eg. * (access Civi || access AJAX) && (access CiviEvent || access CiviContribute) * 'myaction' => [ - * ['access CiviCRM', 'access Ajax API'], + * ['access CiviCRM', 'access AJAX API'], * ['access CiviEvent', 'access CiviContribute'] * ], * -- 2.25.1