Don't show SQL text in SK if user does not have view debug permission
authorlarssandergreen <lars@wildsight.ca>
Mon, 3 Jul 2023 04:41:36 +0000 (22:41 -0600)
committerlarssandergreen <lars@wildsight.ca>
Mon, 3 Jul 2023 04:41:36 +0000 (22:41 -0600)
ext/search_kit/ang/crmSearchAdmin.ang.php
ext/search_kit/ang/crmSearchAdmin/resultsTable/crmSearchAdminResultsTable.component.js
ext/search_kit/ang/crmSearchAdmin/resultsTable/debug.html

index 505641b6139f60571ecd7c1d889178869f7603ea..dece897b1b6694cf123a4760cd9e30f860141975 100644 (file)
@@ -21,5 +21,6 @@ return [
     'all CiviCRM permissions and ACLs',
     'administer CiviCRM',
     'administer afform',
+    'view debug output',
   ],
 ];
index 2e7d40857ff56b2a744390f07fc528805faf9c1d..a9ba4054221bbc7ff26c03d0b1fb709ac481151d 100644 (file)
@@ -26,6 +26,9 @@
         ctrl.debug = {
           apiParams: JSON.stringify(ctrl.search.api_params, null, 2)
         };
+        ctrl.perm = {
+          viewDebugOutput: CRM.checkPerm('view debug output'),
+        };
         ctrl.results = null;
         ctrl.rowCount = null;
         ctrl.page = 1;
index f80476cdaf6fa31497fc7356301a4e1cb73367dd..a61f99abe90e98d0094a118298ee3dffb55da54d 100644 (file)
@@ -9,8 +9,10 @@
       <strong>API:</strong>
     </div>
     <pre>{{ $ctrl.debug.apiParams }}</pre>
-    <strong>SQL:</strong>
-    <pre ng-if="!$ctrl.debug.sql">{{:: ts('Run search to view SQL') }}</pre>
-    <pre ng-repeat="query in $ctrl.debug.sql">{{ query }}</pre>
+    <div ng-if="$ctrl.perm.viewDebugOutput">
+      <strong>SQL:</strong>
+      <pre ng-if="!$ctrl.debug.sql">{{:: ts('Run search to view SQL') }}</pre>
+      <pre ng-repeat="query in $ctrl.debug.sql">{{ query }}</pre>
+    </div>
   </div>
 </fieldset>