Widget: DataExporter: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 12: | Line 12: | ||
const permittedUsers = ['Eschmidt']; | const permittedUsers = ['Eschmidt']; | ||
async function exportData() { | async function exportData() { | ||
const usrData = await fetch(usr).then(rsp => rsp.json()); | const usrData = await fetch(usr).then(rsp => rsp.json()); | ||
const usrName = usrData?.query?.userinfo?.name; | const usrName = usrData?.query?.userinfo?.name; | ||
const output = document.getElementById('output'); | |||
if (!permittedUsers.includes(usrName)) { | if (!permittedUsers.includes(usrName)) { | ||
output.innerHTML = '<span style="color:red; font-size:large">Access Denied</span>'; | output.innerHTML = '<span style="color:red; font-size:large">Access Denied</span>'; |