4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
20 * Class to handle the permission on the api4 AJAX route
22 class CRM_Api4_Permission
{
24 public static function check() {
25 $config = CRM_Core_Config
::singleton();
26 $urlPath = explode('/', $_GET[$config->userFrameworkURLVar
]);
28 ['access CiviCRM', 'access Ajax API'],
30 if (!empty($urlPath[3])) {
31 $entity = $urlPath[3];
32 $action = $urlPath[4];
33 CRM_Utils_Hook
::alterApiRoutePermissions($permissions, $entity, $action);
35 return CRM_Core_Permission
::check($permissions);