Merge pull request #22464 from colemanw/extRequirementCheck
[civicrm-core.git] / ext / search_kit / search_kit.php
index b4ebc20780e8d4262fd3bc6fcd8acd1e1025ae5a..24a0e76058af4593fda561d6b738a9b39ddce263 100644 (file)
@@ -24,24 +24,18 @@ function search_kit_civicrm_container($container) {
 }
 
 /**
- * Implements hook_civicrm_xmlMenu().
+ * Implements hook_civicrm_alterApiRoutePermissions().
  *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_xmlMenu
- */
-function search_kit_civicrm_xmlMenu(&$files) {
-  _search_kit_civix_civicrm_xmlMenu($files);
-}
-
-/**
- * Implements hook_civicrm_managed().
+ * Allow anonymous users to run a search display. Permissions are checked internally.
  *
- * Generate a list of entities to create/deactivate/delete when this module
- * is installed, disabled, uninstalled.
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed
+ * @see CRM_Utils_Hook::alterApiRoutePermissions
  */
-function search_kit_civicrm_managed(&$entities) {
-  _search_kit_civix_civicrm_managed($entities);
+function search_kit_civicrm_alterApiRoutePermissions(&$permissions, $entity, $action) {
+  if ($entity === 'SearchDisplay') {
+    if ($action === 'run' || $action === 'download' || $action === 'getSearchTasks') {
+      $permissions = CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION;
+    }
+  }
 }
 
 /**
@@ -55,7 +49,6 @@ function search_kit_civicrm_managed(&$entities) {
  * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
  */
 function search_kit_civicrm_angularModules(&$angularModules) {
-  _search_kit_civix_civicrm_angularModules($angularModules);
   // Fetch all search tasks provided by extensions and add their Angular modules as crmSearchTasks dependencies
   $tasks = [];
   $null = NULL;
@@ -75,15 +68,6 @@ function search_kit_civicrm_angularModules(&$angularModules) {
   }
 }
 
-/**
- * Implements hook_civicrm_alterSettingsFolders().
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders
- */
-function search_kit_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
-  _search_kit_civix_civicrm_alterSettingsFolders($metaDataFolders);
-}
-
 /**
  * Implements hook_civicrm_entityTypes().
  *
@@ -95,13 +79,6 @@ function search_kit_civicrm_entityTypes(&$entityTypes) {
   _search_kit_civix_civicrm_entityTypes($entityTypes);
 }
 
-/**
- * Implements hook_civicrm_themes().
- */
-function search_kit_civicrm_themes(&$themes) {
-  _search_kit_civix_civicrm_themes($themes);
-}
-
 /**
  * Implements hook_civicrm_pre().
  */