Forum Discussion

StephenStephen1's avatar
StephenStephen1
Qrew Member
7 years ago

Is there a way to see who has EXPORTED data, and include a date/time stamp?

I am trying to determine if a User exported the client list in a particular time frame.   Can this be done?

2 Replies

  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    Not that I know of, but you can now control which roles have the permissions to export data. 

    You can modify this in the roles and permission settings.
  • Yes there is a way to do this using a Service Worker. You can do this in Chrome, FireFox, Opera today and on or about Otober 17 in Edge.

    Rather unexpectedly a new development has happened in that Clourflare (a hosting company) has adopted the Service Worker API that works server side rather than client side (in your browser) and created a jsfiddle.net like playground were you can implement a Service Worker to operate against any domain and share it. So that is exactly what I have done here:

    Log Exports to Log Table Service Worker
    https://cloudflareworkers.com/#0faeec792c0279d10ba9b2e1f5f4348c:https://haversineconsulting.quickbas...

    Feel free to load this page and navigate around my QuidkBase applicaiton. If you choose either of the two predefined CSV reports (CSV1 or CSV2) they will download in the usual fashion the CSV file as well as  be logged to the Log table automatically by the Service Worker. This just a simple demo where I am only detecting the qid=5 or qid=6 reports are being requested but a more comprehensive logic could detect other CSV export URL by various other means.




    Here is the code shown in the playground highlighting the regular expressioin I am detecting 
    var dbid = "bm5tmtkbc";
    var dbddTable = "bm5tmtkbx";
    var dbddLogs = "bm5tnrevv";
    var apptoken = "dkcygh3dsf2nsbpzkj2kyar2xj";
    addEventListener("fetch", event => {
      event.respondWith(fetchAndLog(event.request))
    });
    async function fetchAndLog(request) {
      let response = await fetch(request);
      let re = new RegExp(/bm5tmtkbx\?a=q&qid=5|bm5tmtkbx\?a=q&qid=6/);
      let urlVisited = request.url;
      if (re.test(urlVisited)) {
        var formData = new FormData();
        formData.append("_fid_6", urlVisited);
        await fetch("https://haversineconsulting.quickbase.com/db/bm5tnrevv?act=API_AddRecord";, {
          method: "POST",
          body: formData
        });
      }
      return response;
    }
    This same code can be used for a Service Worker in your browser today to accomplish the same thing