SearchKit - Sync menu & navigation permissions to use 'administer CiviCRM data'
authorColeman Watts <coleman@civicrm.org>
Wed, 19 May 2021 20:03:48 +0000 (16:03 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 20 May 2021 12:13:53 +0000 (08:13 -0400)
Fixes dev/core#2619
https://lab.civicrm.org/dev/core/-/issues/2619

ext/search_kit/CRM/Search/Upgrader.php
ext/search_kit/xml/Menu/search_kit.xml

index 3f6de4d5eea7139877b9977cdb41c362a4e6298c..31c06e64ca70a425cc359d75de17b31ddb2de720 100644 (file)
@@ -18,6 +18,7 @@ class CRM_Search_Upgrader extends CRM_Search_Upgrader_Base {
       ->addValue('icon', 'crm-i fa-search-plus')
       ->addValue('has_separator', 2)
       ->addValue('weight', 99)
+      ->addValue('permission', 'administer CiviCRM data')
       ->execute();
   }
 
@@ -133,4 +134,14 @@ class CRM_Search_Upgrader extends CRM_Search_Upgrader_Base {
     return TRUE;
   }
 
+  /**
+   * Upgrade 1004 - fix menu permission.
+   * @return bool
+   */
+  public function upgrade_1004() {
+    $this->ctx->log->info('Applying update 1000 - fix menu permission.');
+    CRM_Core_DAO::executeQuery("UPDATE civicrm_navigation SET permission = 'administer CiviCRM data' WHERE url = 'civicrm/admin/search'");
+    return TRUE;
+  }
+
 }
index 168defc411e816ece36869c80062e17f00c2051a..eb53c327096eb0cdfb907ff013d65fe489108183 100644 (file)
@@ -8,6 +8,6 @@
   <item>
     <path>civicrm/admin/search</path>
     <page_callback>CRM_Search_Page_Admin</page_callback>
-    <access_arguments>administer CiviCRM</access_arguments>
+    <access_arguments>administer CiviCRM data</access_arguments>
   </item>
 </menu>