How to do a Quick Repair and Rebuild from the DetailView

I am currently on SuiteCRM 7.5.1.

I have a function on my Opportunities DetailView like so:

function clearTpls(){
        require_once("modules/Administration/QuickRepairAndRebuild.php");
        $randc = new RepairAndClear();
        $randc->repairAndClearAll(array('clearTpls'),array('Opportunities'), $autoexecute,$show_output);
    }

However, if I load in as a non-admin user, I get ‘Unauthorized Access’ when I attempt to access the Sale DetailView.

I already tried ‘Repair Roles’ and ‘Quick Repair and Rebuild’. If I remove this code, the problem goes away.

Is there:

  1. A way to trigger this function from another location that will not cause the role issue OR
  2. A way to temporarily grant admin access long enough to trigger the function and then restore their role back OR
  3. Some other solution I’m not thinking of